2

i'm currently using two nvidia p4 graphic cards.

In previous version of ffmpeg(before 3.2.0), i could choose specific gpu card by using options "-gpu 0 or 1 etc".

In current version, however, there's no option for selecting gpu card.

Actually there's "gpu" option specified in nvenc_h264.c or nvenc_hevc.c.

But in nvenc.c file, there's no code that uses "gpu" option.

Is there any way that i can choose specific card?

How load balancing between two cards is done?

Is it done in driver level?

Thank you.

jsBaek
  • 101
  • 2
  • 5
  • Show the full ffmpeg command you tried and its console output. – Gyan Jan 31 '17 at 12:03
  • it goes like below ```ffmpeg -y -hwaccel cuvid -gpu 2 -c:v h264_cuvid -i input.mp4 -vf scale_npp=1280:720 -c:v h264_nvenc -gpu 0 output.mp4``` For any number after "-gpu", it works. it's problem. if i indicate gpu which is not exist, it shouldn't be working. – jsBaek Feb 01 '17 at 01:30
  • I'm not clear. So the GPU selection works if the index is valid but not otherwise? – Gyan Feb 01 '17 at 05:22

2 Answers2

5

I have this same issue. When transcoding, no matter which gpu I select with -gpu option, ffmpeg always use gpu #0.

I managed to solve it by use -hwaccel_device # instead of -gpu

For example:

ffmpeg -hwaccel_device 0 -hwaccel cuvid -c:v h264_cuvid -i <input> -b:v 2048k -vf scale_npp=1280:-1 -c:v h264_nvenc -y <output>
kelgon
  • 391
  • 3
  • 6
0

If automatic load balancing is good enough for you, you can do the following

    if (ctx->codec_id == AV_CODEC_ID_H264){
         av_opt_set(ctx->priv_data, "gpu", "any", 0);
     }

-gpu any/list

Also in case you are looking for command line take a look at this post

mbparsa
  • 1
  • 6