Choose GPU To Be Used In FFmpeg

Choose GPU To Be Used In FFmpeg

In this article i will show how to choose GPU card to be used by NVENC in FFmpeg if you have more than one NVIDIA video card.

To see the list of all available GPUs in you system use nvidia-smi command:

$ nvidia-smi

nvidia-smi output example

In this output you can see I have 2 GPUs in my system:

  • 0 – Quadro P4000
  • 1 – GeForce GTX 107

 

To specify the GPU should be used by NVENC encoder use option -gpu N, where N is number of NVIDIA graphic card.

Below you see FFmpeg GPU Transcoding example command with choosing GPU number 0 (im my case it Quadro P4000) in FFmpeg:

$ ffmpeg -i video.mpg -vcodec h264_nvenc -gpu 0 -acodec copy -f mpegts output_video.mpg

To use second NVIDIA video card simply change from -gpu 0 to -gpu 1.

arstech

One Comment

Leave a Reply