Skip to content

Instantly share code, notes, and snippets.

@joemfox
Created February 25, 2016 18:27
Show Gist options
  • Select an option

  • Save joemfox/c4ebb4e60846348e5d8a to your computer and use it in GitHub Desktop.

Select an option

Save joemfox/c4ebb4e60846348e5d8a to your computer and use it in GitHub Desktop.
ffmpeg commands to encode videos to mp4 and webm for HTML5 <video> tagMP
IF YOU DON'T NEED SOUND, ADD -an BEFORE -f
MP4
ffmpeg -i inputfile.mov -c:v libx264 -vf scale=-1:desiredvideoheightinpixels -pix_fmt yuv420p -profile:v baseline -crf 22 -f mp4 outputfile.mp4
(to adjust quality, change -crf — lower is better, higher is smaller file size)
–––––––––––––
–––––––––––––
WEBM
ffmpeg -i inputfile.mov -codec:v libvpx -quality good -b:v 500k -qmin 10 -qmax 42 -vf scale=-1:desiredvideoheightinpixels -codec:a libvorbis -f webm outputfile.webm
(to adjust quality, change -b:v (bitrate) — 180k is v low, go higher if it looks bad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment