openCV - Method to use user-built ffmpeg in windows OS

openCV - Method to use user-built ffmpeg in windows OS

Hi Technical Team,

I am using Opencv 4.9.0 in windows 11 OS.

I have read the readme.txt from openCV source directory “opencv-4.9.0\3rdparty\ffmpeg”.
From the “readme.txt” file, I understood that Linux platform is having support to use user-build ffmpeg but it is not mentioned for windows platform.

My question:

How do i customize/configure CMake to use “user-build ffmpeg” ?

Thanks,
Ratheesh

Hi,
Thanks for your immediate response.

From your above link i could not find below suggested directory in source of opencv-4.9.0 or also in build directory **<FFMPEG_BUILD>**

My question:

  1. Is this directory needs to be created? , if yes please suggest the location?

Regards,
Ratheesh

**<FFMPEG_BUILD>** is the directory containing your ffmpeg build.

You then add the cmake script and add it to your path. I don’t think the linked cmake script works with the latest version of FFMpeg but the two pre-built versions I linked to in that post will.

Hi,
Thanks for your response.

I have followed steps 1 to 4 from the above link.
For the step 5 ( flag OPENCV_FFMPEG_USE_FIND_PACKAGE=ON) , I am not finding this flag OPENCV_FFMPEG_USE_FIND_PACKAGE in cmake-gui.

Please find the screenshot for this

Please give your suggestion.

Regards,
Ratheesh

Either add it using Add Entry or use the command line. I would use the CMake command line and not the GUI because you will be able to get more help when things go wrong. i.e. Its easy to reproduce exactly what you have done.

Hi,
I am not familiar with command line execution in CMake.

After followed your instructed steps, i found below in CMake-GUI console only

Video I/O:
DC1394: NO
FFMPEG: YES (find_package)
avcodec: YES (59.18.100)
avformat: YES (59.16.100)
avutil: YES (57.17.100)
swscale: YES (6.4.100)
avresample: NO
DirectShow: YES
Media Foundation: YES
DXVA: YES

My Question:

  1. which location can i find cmake output log details to confirm the FFMpeg inclusion?

Regards,
Ratheesh

The output above confirms it. The prebuilt binaries output would be

--   Video I/O:
--     DC1394:                      NO
--     FFMPEG:                      YES (prebuilt binaries)
--       avcodec:                   YES (58.134.100)
--       avformat:                  YES (58.76.100)
--       avutil:                    YES (56.70.100)
--       swscale:                   YES (5.9.100)
--       avresample:                YES (4.0.0)
--     GStreamer:                   NO
--     DirectShow:                  YES
--     Media Foundation:            YES
--       DXVA:                      YES

Don’t forget to add <FFMPEG_BUILD>/bin to your path.