Opened 3 years ago
Last modified 3 years ago
#8666 new enhancement
ffmpeg hardware accel command line settings are inconsistent
|Reported by:||Kurt Fitzner||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
The way that ffmpeg specifies different hardware acceleration options on the command line spans different switch paradigms.
cuvid (decode) must be specified with with -c:v codec switch.
cuda (decode) must be specified with -hwaccel cuda
Additionally, it would be beneficial to separate specifying the decoding/encoding hardware from specifying the codec format and to remove the requirement to specify the hardware decoding codec. ffmpeg should detect the correct decoder and not require the user to know what the input file's codec actually is.
ffpmeg -vdecoder=cuvid -i input.mkv -vencoder=cuda -c:v hevc output.mp4
Though this may be a step too far, it would also be beneficial to divorce the codec method from the codec library. In other words, stop using the -c:v to tell ffmpeg what library to use. libx264, h264_qsv, h264_nvenc, h264_cuvid and others are all h.264 "codec" names in ffpmeg. It would be much cleaner to:
ffmpeg -i input.mkv -vencoder=software -c:v h264 output.mp4
ffpmeg -i input.mkv -vencoder=cuda -c:v h264 output.mp4
ffpmeg -i input.mkv -vencoder=qsv -c:v h264 output.mp4
or, if you need fine grained specification of the actual software library where there are multiple libraries providing the same codec, then:
ffmpeg -i input.mkv -vencoder=software:libx264 -c:v h264 output.mp4
ffmpeg -i input.mkv -vencoder=software:libnewcoolencoder -c:v h264 output.mp4
It wouldn't be hard to implement this system alongside the old one so as not to break current scripts and GUIs.
Replying to Va1DER:
-hwaccel is the primary method to trigger hardware decoding. The cuvid decoder is deprecated, and uses the same hardware capabilities. With -hwaccel you do not need to know what the input codec is.
I really don't see the advantage in this. You still need to know that its called "qsv" or "cuda", and its longer to boot. -c:v h264_nvenc or -c:v h264_qsv isnt really any different, just less verbose extra options.