Error: 'Your platform doesn't suppport hardware accelerated AV1 decoding.' when i use 'cv2.VideoCapture'

To build against FFmpeg and get AV1 decoding you need to:

  1. Build or download and extract a build of FFMpeg to <FFMPEG_BUILD>. I would suggest simply downloading from here and depending on your license requirements you will want to download either
    ffmpeg-n5.0.1-7-g7389a49fd3-win64-gpl-shared-5.0.zip
    or
    ffmpeg-n5.0.1-7-g7389a49fd3-win64-lgpl-shared-5.0.zip
    Note: I have personally tested these builds and not had an issue but any pre-built shared library build from there should work.
  2. Create a cmake directory <FFMPEG_BUILD>/cmake.
  3. Save the modified cmake script (ffmpeg-config.cmake) adapted from the one mentioned in
    Enabling system FFMPEG on windows · Issue #22273 · opencv/opencv · GitHub
  4. Pass CMAKE_PREFIX_PATH or FFMPEG_DIR set to the directory containing the ffmpeg-config.cmake script. i.e. -DFFMPEG_DIR=<FFMPEG_BUILD>/cmake
  5. Include the flag OPENCV_FFMPEG_USE_FIND_PACKAGE=ON when calling cmake.

Then check your cmake output to confirm you have something similar to the below

– Found FFMPEG: D:/3rd_party/deps/ffmpeg-n5.0-latest-win64-gpl-shared-5.0/include (found version “5.0.1-5-g240d82f26e-20220611”) found components: avutil swresample swscale avcodec avformat avfilter avdevice

and not

– FFMPEG: Downloading opencv_videoio_ffmpeg.dll from https://raw.githubusercontent.com/opencv/opencv_3rdparty/65ec04d4573dcdfa4531f0b9e67f35d8ffff873e/ffmpeg/opencv_videoio_ffmpeg.dll
– FFMPEG: Downloading opencv_videoio_ffmpeg_64.dll from https://raw.githubusercontent.com/opencv/opencv_3rdparty/65ec04d4573dcdfa4531f0b9e67f35d8ffff873e/ffmpeg/opencv_videoio_ffmpeg_64.dll
– FFMPEG: Downloading ffmpeg_version.cmake from https://raw.githubusercontent.com/opencv/opencv_3rdparty/65ec04d4573dcdfa4531f0b9e67f35d8ffff873e/ffmpeg/ffmpeg_version.cmake

1 Like