[FFmpeg-user] The option of -hwaccel device doesn't works well(FFmpeg n3.4)

James Girotti james.girotti at gmail.com
Tue Nov 7 02:08:53 EET 2017


On Sun, Nov 5, 2017 at 6:16 PM, Baek Seung Hoon <seung51hoon at gmail.com>
wrote:

> (Its mail continuous previous my one.. sorry)
> ‚Äč
> I wonder know what is different ffmpeg internal sequence following 2
> commands..
>
> 1.
>  > ffmpeg -y -i ./input.mp4 -filter_complex
> "[0:v]hwupload_cuda=device=0,scale_npp=w=960:h=540[map0]" -map "[map0]"
> -c:v h264_nvenc -c:a copy ./output.mp4
>
> 2.
>  > ffmpeg -y -hwaccel cuvid -i ./input.mp4 -filter_complex
> "[0:v]hwupload_cuda=device=0,scale_npp=w=960:h=540[map0]" -map "[map0]"
> -c:v h264_nvenc -c:a copy ./output.mp4
>
> In fact, the performance is similar as 861 fps for encoding.
> Could I ask you what role "hwaccel cuvid" is in the above command?
>

TLDR: No affect. Maybe a tiny bit of overhead at start.

The answer is probably long and I'll probably be (a little) wrong. From the
wiki page cited earlier; -hwaccel cuvid will attempt to use hw-decoding and
fall-back to sw-decoding if not possible automatically. Without options
'-hwaccel' tries internal hw-decoders before falling-back, because the
cuvid decoders are external you have to specify "cuvid" option and to use
the decoder: -c:v h264_cuvid. Or ffmpeg will fall-back to sw-decoding. So
only specifying '-hwaccel cuvid' without a decoder should fall-back to
sw-decoding automatically.

The whole hwaccel thing is more complex than that because if you use
hw-decoder and hw-encoder, but do not specify '-hwaccel cuvid', then your
frames get passed through system memory. So there must be more happening
with '-hwaccel cuvid' than just setting up a decoder. I tried looking at
the code, but I'm a little lost on this one.


>
> Thanks again :)
>

I'm glad I was able to help. As always, I gained knowledge from helping
you. So, thanks for helping me!


More information about the ffmpeg-user mailing list