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

Baek Seung Hoon seung51hoon at gmail.com
Fri Nov 3 04:38:30 EET 2017


I'm using a machone of FFmpeg n3.4 verison and 2 Nvidia P4 devices.
As a wiki page of HwAcceleration(https://trac.ffmpeg.org/wiki/HWAccelIntro),
I known that I could be select hw device using "-hwaccel device" option.
However It seems hwaccel_device options doesn't work me when I use
filter_complex what included hwupload_cuda.

In case of below example, first deivce(index is 0) is always busy for
encoding job while second device is always free.
I think it would be a problem because I couldn't load balancing the
encoding request to the Gpu devices.

Could you tell me how can I select gpu device with FFmpeg CLI in this


PS. Sorry to low english skills
*Below is the information what needed to test.*
 1. "nvidia-smi -a -q -d utilization" command gave me what number of device
are working now.
 2. Nvidia driver : 384.81, Cuda : 9.0
 3. OS : CentOS 6.9
     CPU : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz * 32
     RAM : 128GB,
 4. Input media is like this
    Duration: 00:01:37.58, start: 0.000000, bitrate: 1642 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 1507 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc

*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
-map [map0] -c:v h264_nvenc -vprofile high -map 0:a -c:a copy  ./output.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
-map [map0] -c:v h264_nvenc -vprofile high -map 0:a -c:a copy ./output.mp4

More information about the ffmpeg-user mailing list