Using ffmpeg-3.1.6-1.fc25.x86_64
on Fedora 25, available from rpmfusion-free repo. It has been built with va-api support.
The following ffmpeg invocation works for me.
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 \
-i input.mkv -vf 'format=nv12,hwupload' -map 0:0 -map 0:1 -threads 4 \
-acodec copy -vcodec h264_vaapi -qp:v 23 \
output.mp4
Using -vcodec hevc_vaapi
instead of -vcodec h264_vaapi
produces h265 output. There was a bug that made output jerky, fixed with -bf 0
flag (remove B-frames)
Credit to: @Brainiarc7 https://gist.github.com/Brainiarc7/95c9338a737aa36d9bb2931bed379219