

Return LoadPackagedLibrary(filename.c_str(), 0) LibHandle_t libraryLoad_(const FileSystemPath_t& filename) Here’s the code that declares the use of the FFMPEG loader: #define DECLARE_DYNAMIC_BACKEND(cap, name, mode) \Ĭap, (BackendMode)(mode), 1000, name, createPluginBackendFactory(cap, name) \ĭECLARE_DYNAMIC_BACKEND(CAP_FFMPEG, "FFMPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER)Īnd if you chase createPluginBackendFactory back (through class PluginBackendFactory, which uses class PluginBackend, which uses DynamicLib::libraryLoad, which calls libraryLoad_), you end up at modules/core/include/opencv2/core/utils/plugin_ line 73: static inline

The DLL is not loaded from the Python code at all - it’s done dynamically from the C++ code. Maybe when the importlib.import_module static optimization is working, and it seems it does for simple cases, we can attempt to also detect DLL loads from the Python code, maybe this is done with ctypes, it it? (Off topic: Many thanks for all your hard work on Nuitka 😄) I can use VideoWriter) but it’s a bit fragile as it assumes that I’m using Anaconda and Windows (although that is likely to usually be true for me) and the specific FFmpeg number will change as OpenCV version changes. I considered -include-package-data= but it specifically says it excludes DLLs.įor now I am using -include-data-file=%CONDA_PREFIX%\Lib\site-packages\cv2\opencv_videoio_ffmpeg453_64.dll=opencv_videoio_ffmpeg453_64.dll and it works (e.g.I considered -include-data-file= but it takes a file system path, not a path relative to the Python environment.I considered (and tried!) -include-plugin-files= but it seems to be for Python files to be compiled.This is more a question than a bug report: what command line option (if any) could I use to include this file?

This is done as part of satisfying the LGPL requirements of FFmpeg. VideoWriter will throw a Python exception). But this is to be expected because it’s loaded dynamically only when needed, with a graceful failure (e.g. The exact file name depends on the version of FFmpeg, which in turn depends on the version of opencv-python in this version particular it is: \Lib\site-packages\cv2\opencv_videoio_ffmpeg453_64.dll Opencv-python includes a build of FFmpeg as a dll. I am using -plugin-enable=numpy -plugin-enable=anti-bloat to enable use of numpy, which is a dependancy of OpenCV for Python. I am using Python 3.8.11 (through Anaconda) on Windows, with packages (installed with pip, not conda): Nuitka=0.6.17.2
