[FFmpeg-devel] [PATCH] (for discussion): ffmpeg: prefer cuvid decoders when use option -cuvid

Mark Thompson sw at jkqxz.net
Sun Feb 12 23:20:12 EET 2017


On 12/02/17 20:37, Miroslav Slugeň wrote:
> This patch is for discussion only, not ready to commit yet and maybe newer will be.
> 
> We were facing issue when using -hwaccel cuvid we have to also specify input decoder like -c:v XXXX_cuvid for every input and input video format was sometimes mpeg2/h264/hevc. So this is my FIX/HACK to only specify -cuvid and ffmpeg will pick cuvid decoder for any supported input.
> 
> I don't know correct solution for this yet.

Adding global variables to libraries to mess with their internals is not an acceptable solution to anything.

The correct solution to this problem is to write a real cuvid hwaccel, which works within the existing decoder to offer decoding of streams which it supports without changing the behaviour at all in normal software cases (compare the behaviour of cuvid (standalone decoder) with dxva2, vaapi or vdpau (full hwaccels inside the normal decoder)).

An alternative solution for your specific case would be to disable the normal H.264, MPEG-2, etc. decoders in your build, such that the cuvid decoder appears first in the list and would always be picked for any given stream.  (This of course would also remove support for the wider set of streams which the libavcodec decoders support, such as H.264 at higher big depths, though given that your patch here also has that effect I assume you aren't particularly concerned about that case.)

- Mark


More information about the ffmpeg-devel mailing list