简体   繁体   中英

How use FFMPEG multi GPU proccess


I have a problem and cant find any suitable answer for it.
Its about use multi GPU proccess.
I have 3 graphic card and you could see it:

[![enter image description here][1]][1]

if image not loaded use this image link: https://i.stack.imgur.com/msR83.jpg enter link description here


My problem is: when i run more than one ffmpeg command with cuda all process assigned to first GPU.
like below image:

[![enter image description here][2]][2]

if image not loaded use this image link: https://i.stack.imgur.com/PfYfz.jpg

you see? all 6 proccess assigned to first GPU.
I really confused how could i fix it.

my FFMPEG code is:

 ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i my-video.mp4 \ -vf scale_npp=w=426:h=240 -c:v h264_nvenc -profile:v main -b:v 400k -sc_threshold 0 -g 25 \ -c:a aac -b:a 64k -ar 48000 \ -f hls -hls_time 6 -hls_playlist_type vod \ -hls_allow_cache 1 -hls_key_info_file encription.keyinfo \ -hls_segment_filename f-0-seg-%d.ts f-0.m3u8

i run top FFMPEG code for 6 diffrent video at same time.
please help to find answer. by sharing your knowledge or some links that could help me.
Thanks a lot.

The Process seems fairly straigh forward from what I can tell: https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/

Encoding and decoding work must be explicitly assigned to a GPU when using multiple GPUs in one system. GPUs are identified by their index number; by default all work is performed on the GPU with index 0. Use the following command to obtain a list of all NVIDIA GPUs in the system and their corresponding ID numbers:

ffmpeg -vsync 0 -i input.mp4 -c:v h264_nvenc -gpu list -f null –

Once you know the index, the -hwaccel_device index flag can be used to set the active GPU for decoding and encoding. In the example below the work will be executed on the gpu with index 1.

ffmpeg -vsync 0 -hwaccel cuvid -hwaccel_device 1 -c:v h264_cuvid -i input.mp4 -c:a copy -c:v h264_nvenc -b:v 5M output.mp4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM