I have downloaded OpenCV-python sourcecode from https://pypi.org/project/opencv-python/ and am trying to build it on OpenSuse.
I have ffmpeg already installed as shown here and I wish to use this installed version and not build my own ffmpeg:
/home/adminlinux/Downloads/build # ffmpeg -version
ffmpeg version 3.4.8 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (SUSE Linux)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg
--extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
When I build using the following cmake command:
cmake ../opencv-python-4.4.0.46/opencv/
I see that FFMPEG is not detected:
Video I/O:
-- DC1394: NO
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
This link is indicating that I need to indicate where my ffmpeg libraries are: Configure and Build OpenCV to Custom FFMPEG Install
So I have tried the following flags but still got the same output:
cmake -DHAVE_FFMPEG=ON -DFFMPEG_LIBDIR="/usr/lib64" -DFFMPEG_INCLUDE_DIRS="/usr/lib64" ../opencv-python-4.4.0.46/opencv/
I then tried the following flags (OPENCV_FFMPEG_SKIP_BUILD_CHECK and BUILD_SHARED_LIBS):
cmake -DHAVE_FFMPEG=ON -DFFMPEG_LIBDIR="/usr/lib64" -DFFMPEG_INCLUDE_DIRS="/usr/lib64" -D OPENCV_FFMPEG_SKIP_BUILD_CHECK=ON -D BUILD_SHARED_LIBS=OFF ../opencv-python-4.4.0.46/opencv/
And this time I notice that FFMPEG is now ON but the libs are NO:
Video I/O:
-- DC1394: NO
-- FFMPEG: YES
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
What else can I do to enable the codecs? I am stabbing in the dark at this stage.
EDIT
I downloaded the source code for open-cv (not opencv-python) from https://opencv.org/opencv-4-4-0/
Each of the following cmake commands resulted in the same output:
cmake ../opencv-4.4.0
cmake -DHAVE_FFMPEG=ON ../opencv-4.4.0
cmake -DHAVE_FFMPEG=ON -DWITH_FFMPEG=ON ../opencv-4.4.0
cmake -DHAVE_FFMPEG=ON -DWITH_FFMPEG=ON -DFFMPEG_LIBDIR="/usr/lib64/" ../opencv-4.4.0
cmake -DHAVE_FFMPEG=ON -DWITH_FFMPEG=ON -DFFMPEG_LIBDIR="/usr/lib64" -DFFMPEG_INCLUDE_DIRS="/usr/lib64/" ../opencv-4.4.0
Result:
Video I/O:
-- DC1394: NO
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
And the following commands:
cmake -DHAVE_FFMPEG=ON -DWITH_FFMPEG=ON -DFFMPEG_LIBDIR="/usr/lib64" -DFFMPEG_INCLUDE_DIRS="/usr/lib64" -D OPENCV_FFMPEG_SKIP_BUILD_CHECK=ON ../opencv-4.4.0
cmake -DHAVE_FFMPEG=ON -DWITH_FFMPEG=ON -DFFMPEG_LIBDIR="/usr/lib64" -DFFMPEG_INCLUDE_DIRS="/usr/lib64" -D OPENCV_FFMPEG_SKIP_BUILD_CHECK=ON -D BUILD_SHARED_LIBS=OFF ../opencv-4.4.0
Result
Video I/O:
-- DC1394: NO
-- FFMPEG: YES
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
Is there any other flags etc that I need/could use? Or any way to debug why its not detecting my ffmpeg?