Trying to use AMD GPU for transcoding MJPEG to HEVC using VA-API.

Using this command:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -c:v mjpeg -f v4l2 -input_format mjpeg -framerate 30 -video_size 1920x1080 -i /dev/video0 -vf 'scale_vaapi=format=nv12' -c:v hevc_vaapi -map 0:a? -map 0:s? -c:s copy -rc_mode 1 -qp 25 -map_chapters 0 output.mp4 -y

And it seems to work fine, no skipped frames, smooth transcoding, only 2-3% CPU usage. However the video output file is completely skewed.

For some reason FFMPEG splits the video into two pieces where one half of the video is the actually the proper video and the other half is all skewed up.

Here is a picture of the video output:

Note: The camera is a CCTV camera, which is using it's infrared LEDs to view in the dark room. So it is in greyscale color due to the camera and not any issues based on transcoding.

enter image description here


Here is the output video file:

Any clue why this is happening?

OS: Arch Linux

GPU: AMD Radeon Pro WX 2100.

Thanks for any advice.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.