Hi,
I try to specify hardware acceleration for my VideoCapture() bit of code and I am using cv.CAP_FFMPEG as my backend. I found some pointers on the web that if I set
import cv2
import os
os.environ['OPENCV_FFMPEG_CAPTURE_OPTIONS'] = 'video_codec;mpeg2_cuvid'
os.environ['OPENCV_FFMPEG_DEBUG'] = '1'
os.environ['OPENCV_LOG_LEVEL'] = 'DEBUG'
cap = cv2.VideoCapture('my_video.m2v', cv2.CAP_FFMPEG)
while cap.isOpened():
ret, frame = cap.read()
...
Triggers a lot of callback error messages, this gist of which are
[OPENCV:FFMPEG:24] Estimating duration from bitrate, this may be inaccurate
[OPENCV:FFMPEG:40] CUVID capabilities for mpeg2_cuvid:
[OPENCV:FFMPEG:40] 8 bit: supported: 1, min_width: 48, max_width: 4080, min_height: 16, max_height: 4080
[OPENCV:FFMPEG:40] 10 bit: supported: 0, min_width: 0, max_width: 0, min_height: 0, max_height: 0
[OPENCV:FFMPEG:40] 12 bit: supported: 0, min_width: 0, max_width: 0, min_height: 0, max_height: 0
[OPENCV:FFMPEG:24] Invalid pkt_timebase, passing timestamps as-is.
[OPENCV:FFMPEG:40] Formats: Original: nv12 | HW: nv12 | SW: nv12
[OPENCV:FFMPEG:16] ctx->cvdl->cuvidCreateDecoder(&ctx->cudecoder, &cuinfo) failed -> CUDA_ERROR_NOT_SUPPORTED: operation not supported
[OPENCV:FFMPEG:16] cuvid decode callback error
I have a cuda enabled build of ffmpeg (6.1) and opencv-4.9.0 (also cuda enabled build). Running ffmpeg from the cli with -hwaccel cuda option appears to create the desired effect though, so I don’t think the issue is with my build of ffmpeg.
Any ideas?