Showing results for 
Search instead for 
Did you mean: 

Graphics Cards

Journeyman III

Using FFMPEG with Radeon GPU


  1. Does anyone use the Radeon GPU for FFMPEG rendering?
  2. Is there a way to tell how loaded the GPU(s) are?
  3. Is anyone getting better than 1.9x performance?
  4. Is anyone able to get more than one stream working at a time?
  5. Has anyone solved the AMDGPU context error issue?

My System:

Ubuntu 18.04 LTS
Radeon Pro Drivers

FFMPEG (latest) compiled: ffmpeg version N-96728-ge007059

Hardware acceleration methods:



V..... libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
V..... libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
V..... h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec h264)
V..... h264_vaapi H.264/AVC (VAAPI) (codec h264)


VFS..D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
V..... h264_v4l2m2m V4L2 mem2mem H.264 decoder wrapper (codec h264)

Random Failures with this error:

amdgpu: The CS has been cancelled because the context is lost.

Example FFMPEG Command:

~/bin/ffmpeg -hwaccel vaapi  -threads 16 -vcodec h264_v4l2m2m -i input.mp4  -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format='nv12|vaapi,hwupload','deinterlace_vaapi=rate=field:auto=1,scale_vaapi=w=-1:h=480,hwupload' -b:v 2M output.mp4 -y

Performance is pretty bad: Ont 1.9 to 2.2x and you can only run one stream at a time.

There is no way to find out how utilized the GPU is.

Performance Results with "Time"

frame=100852 fps=122 q=-0.0 Lsize= 438812kB time=00:28:02.63 bitrate=2136.4kbits/s dup=4 drop=0 speed=2.03x
video:410551kB audio:26348kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.437883%
[aac @ 0x56160c682a40] Qavg: 333.827

real 13m50.061s
user 2m25.641s
sys 1m20.288s

On an NVIDIA 1060 this takes about 3 minutes.

1 Reply
Journeyman III

Added performance and configuration data to the original question