jsBaek
jsBaek

Reputation: 131

How to choose gpu among multiple nvidia gpu in ffmpeg 3.2.0?

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.

Upvotes: 4

Views: 8551

Answers (2)

kelgon
kelgon

Reputation: 401

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>

Upvotes: 6

mbparsa
mbparsa

Reputation: 1

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

Upvotes: 0

Related Questions