When downloading OpenCV sources, no matter whether it is for Windows or for Linux, the sources directory contains only the Windows already-compiled shared library 3rdparty/ffmpeg/opencv_ffmpeg.dll
, that is essential for the VideoCapture
module to work on the Python portings for OpenCV.
In Linux, as this file is not provided, you'd expect it to be automatically built when you build OpenCV, especially when in CMakeCache.txt
, you can spot the line WITH_FFMPEG:BOOL=ON
.
It is of course not built... Any idea?
Found a great workaround - sharing with everybody.
Instead of using OpenCV's
VideoCapture
, I use the libraryscikit-video
.First, installing it (make sure to install a late enough version):
Then, reading videos in the following way:
Further docs and examples are available here: http://www.scikit-video.org/stable/io.html