-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
4.5.2 Videoio breaking change for GPU acceleration #19867
Description
System information (version)
- OpenCV => 4.5.2
- Operating System / Platform => Linux x64
- Compiler => GCC
- API: Python 3.8.9
- nVidia Cuda: 11.2.1
- Cudnn: 8.1.1
Detailed description
After upgrading from 4.5.1 to 4.5.2 the ffmpeg backend videoio decoding/encoding broke.
Also posted in the forum:
https://forum.opencv.org/t/opencv-4-5-2-breaking-change-with-ffmpeg-hw-accelerated-decoding/2613/2
Steps to reproduce
Old syntax to start a video capture stream
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"]="hwaccel;cuvid|video_codec;h264_cuvid|vsync;0"
stream = cv2.VideoCapture(rtsp_server_uri, cv2.CAP_FFMPEG)
Upgrading to 4.5.2 will lead to failure to start the stream without any error message on python.
After looking at documentation it appears that there are new features additions which have broken the hardware acceleration. After a few tests, the closest I have come to get it to work was:
os.environ[ "OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "hw_decoders_any;cuda"
stream = cv2.VideoCapture(rtsp_server_uri, cv2.CAP_FFMPEG, (cv2.CAP_PROP_HW_ACCELERATION, cv2.VIDEO_ACCELERATION_ANY))
But it still found the url and started the stream without any decoding. Verified the problem by recompiling 4.5.1 with the exact same libraries and found it to work fine.