Skip to content

Instantly share code, notes, and snippets.

@k3a
Created September 4, 2019 19:47
Show Gist options
  • Save k3a/dcfb3c34745899c50eb1bb0967c0f3be to your computer and use it in GitHub Desktop.
Save k3a/dcfb3c34745899c50eb1bb0967c0f3be to your computer and use it in GitHub Desktop.
#!/bin/sh
#FLAGS="-hide_banner -loglevel error "
FLAGS="-hide_banner -loglevel warning "
echo === 128 AMD ====
vainfo --display drm --device /dev/dri/renderD128 | head -n3
# produces 5240 kb/s on Linux 5.2.9 ffmpeg-4.2-4 libva-mesa-driver-19.1.5-1 (3.9.2019)
time ffmpeg $FLAGS -vaapi_device /dev/dri/renderD128 -i big_buck_bunny_720p_1mb.mp4 -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 5M -y new_bunny_128.mp4
echo === 129 Intel ===
vainfo --display drm --device /dev/dri/renderD129 | head -n3
# produces 76 kb/s on Linux 5.2.9 ffmpeg-4.2-4 libva-mesa-driver-19.1.5-1 (3.9.2019)
#time ffmpeg $FLAGS -vaapi_device /dev/dri/renderD129 -i big_buck_bunny_720p_1mb.mp4 -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 5M -y new_bunny_129.mp4
# produces 5265 kb/s
#time ffmpeg $FLAGS -vaapi_device /dev/dri/renderD129 -i big_buck_bunny_720p_1mb.mp4 -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 5M -rc_mode:v CBR -y new_bunny_129.mp4
# produces 4830 kb/s (= if VBR is is used, bitrate must be set but maxrate as well!)
time ffmpeg $FLAGS -vaapi_device /dev/dri/renderD129 -i big_buck_bunny_720p_1mb.mp4 -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 5M -maxrate:v 5M -rc_mode:v VBR -y new_bunny_129.mp4
ls -lh new_bunny_*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment