Hello, Let me start by saying that I only have one NVENC capable GPU, so I cannot test this. I hope to point you in the right direction though.
On Thu, Nov 2, 2017 at 7:38 PM, Baek Seung Hoon <[email protected]> wrote: > Could you tell me how can I select gpu device with FFmpeg CLI in this > problem? > For all of the nvenc encoders there is a '-gpu' option: "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)" The cuvid decoders have similar '-gpu' options. > *====================================================* > *Below is test command* > 1. The first gpu device(index is 0) is always working although input option > is hwaccel_device 1. > $) ffmpeg -hwaccel_device 1 -y -i ./input.mp4 -filter_complex > "[0:v]hwupload_cuda,scale_npp=w=960:h=540:format=yuv420p: > interp_algo=lanczos,setsar=1[map0]" > -map [map0] -c:v h264_nvenc -vprofile high -map 0:a -c:a copy ./output.mp4 > > The above command doesn't use a hw-decoder (not a real problem if that's what you want.) But I'm not sure if the '-hwaccel_device' option does anything without something like '-hwaccel cuvid' and specifying '-c:v h264_cuvid' before '-i ./input.mp4'. > 2. If I remove "hwupload_cuda" options in filter_complex, hwaccel_device > option works well. > $) ffmpeg -hwaccel_device 1 -hwaccel cuvid -y -c:v h264_cuvid -i > ./input.mp4 -filter_complex > "[0:v]scale_npp=w=960:h=540:format=yuv420p:interp_algo= > lanczos,setsar=1[map0]" > -map [map0] -c:v h264_nvenc -vprofile high -map 0:a -c:a copy ./output.mp4 > This command is significantly different from the previous. It's more than just removing "hwupload_cuda". This command uses hw-decoding, which is why you don't have to "hwupload_cuda" because the frames are already in GPU memory. Also, likely why '-hwaccel_device 1' works. I see that you are using scale_npp to resize your video and I would be amiss if I did not mention that the cuvid decoders have resizing and cropping built in now. You don't need to use scale_npp to scale/resize, you could do something as simple as: ffmpeg -hwaccel_device 1 -hwaccel cuvid -c:v h264_cuvid -resize 960x540 -i ./input.mp4 -vf "setsar=sar=1" -c:v h264_nvenc -vprofile high -map 0:a -c:a copy ./output.mp4 I hope that help! -J _______________________________________________ ffmpeg-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
