Video reader acceleration using graphics card on Linux

1 次查看(过去 30 天)
Is there a way to use graphics acceleration with NVIDIA graphics card to read avi video files encoded with h264
(cisco openh264 or others)? My understanding is that matlab uses gstreamer1.0 to read video files with VideoReader
or vision.VideoFileReader, which supports hardware acceleration.
The documentation states support fore MP4 and MOV file hardware acceleration on windows, but not for linux.
Any insights on wether this is possible through gstreamer, or even ffmpeg on linux ?
I'm analysing very large avi files (of the order of hundreds of thousands or milions of frames) and
hardware acceleration would be hugely beneficial for my analysis pipeline.
Thanks
EDIT: I'm not commited to h264, but it happens to provide a good tradeoff in terms of encoding speed (real-time encoding of ~300 fps 1024x1024 pixels video is a requirement) and file size that i have been unable to obtain with other codecs. I would be very happy to use something else if it does tick those boxes.

采纳的回答

Martin Privat
Martin Privat 2022-7-26
After playing for a while with FFMPEG C API, it turns out that hardware video decoding using h264_cuvid is not faster than decoding on the CPU. The only advantage is that it can free CPU resources for image processing.
Additionally, processing an image generally takes much more time than reading it, which means that a significant speedup can be obtained by parallelizing the processing part (See figure below).
As long as the multithreaded processing part takes longer on each thread than reading the image, there is no advantage in trying to read images faster.
As a side note, many image processing routines in MATLAB rely on Intel's MKL library (blas/lapack) and are already multithreaded. There is less improvements to obtain by trying to process images in parallel if matlab is already using all the cores available

更多回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by