Open kallaballa opened 2 years ago
The only workaround i found is this reasonably low latency pipe:
ffmpeg -v quiet -fflags nobuffer -fflags discardcorrupt -flags low_delay -avioflags direct -video_size 1280x720 -input_format mjpeg -framerate 30 -i /dev/video1 -f matroska -c:v copy pipe:/dev/stdout | src/v4l2-vaapi/v4l2-vaapi /dev/stdin
System Information
OpenCV version: OpenCV 4.x branch (https://github.com/opencv/opencv/commit/2aad039b4f64d8e4a6136388c48d1368c120feec) Operating System / Platform: openSUSE Tumbleweed (Version: 20221102) Compiler & compiler version: g++ (SUSE Linux) 12.2.1 20221020 [revision 0aaef83351473e8f4eb774f8f999bbe87a4866d7]
Detailed description
I'd like to capture an MJPEG stream from a V4L2 device and accelerate decoding using VAAPI. My attempts failed because VAAPI acceleration is not implemented in the VIDEOIO/V4L2-backend and ffmpeg implements V4L2 as de-/muxer which made it impossible for me to activate VAAPI at the same time. Gstreamer is not an option for me because it doesn't support OpenCL/VAAPI interop. Using an MJPEG file as input works.
I use following environment variables:
And run the following command:
With resulting debug log:
Steps to reproduce
Build OpenCV 4.x with:
Clone and build my example:
run it on a video device and it will fail. e.g:
ffplay works:
Run it on an example (attached) MJPEG file (stream copied from V4l2).
The example file was created with following command:
Please rename to example.mkv
vainfo:
v4l2-ctl --list-formats-ext --device /dev/video1:
Issue submission checklist