sufehmi

BEST FILE SIZE + BEST QUALITY ffmpeg encoding with VAAPI / hardware acceleration

Aug 4th, 2021 (edited)
624
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # BEST FILE SIZE + BEST QUALITY ffmpeg encoding with VAAPI / hardware acceleration
  2. # I got about 7x speed up + very low CPU usage
  3. # (so I'm able do other stuff while ffmpeg is busy doing the decoding/encoding)
  4.  
  5. time ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device foo -i input.mp4 -filter_hw_device foo -vf 'format=nv12|vaapi,hwupload,fps=fps=25' -c:v h264_vaapi  -compression_level 1 -c:a copy output.mp4
  6.  
  7. # to find your vaapi device, type : ls  /dev/dri/*
  8.  
  9. # remove ",fps=fps=25" bit if you're not changing the fps rate
RAW Paste Data