Skip to content

Instantly share code, notes, and snippets.

@maxkandler
Last active August 29, 2015 13:56
Show Gist options
  • Save maxkandler/8848725 to your computer and use it in GitHub Desktop.
Save maxkandler/8848725 to your computer and use it in GitHub Desktop.
Simple video conversion to create videos compatible with various browser and devices. Uses ffmpeg on a Mac. Source material is supposed to be a higher quality h.264 video.

Resize a video to 480p w/ max. bitrate of 750k

ffmpeg -i video-raw.mp4 -codec:v libx264 -profile:v main -preset slow -b:v 750k -maxrate 750k -bufsize 1000k -vf scale=720:480 -threads 0 -codec:a libfaac -acodec libfaac -ac 2 -ar 44100 -ab 128k video.mp4

Change only the quality of a video

ffmpeg -i video-raw.mp4 -codec:v libx264 -profile:v main -preset slow -b:v 1000k -maxrate 1000k -bufsize 2000k -threads 0 -codec:a libfaac -acodec libfaac -ac 2 -ar 44100 -ab 128k video.mp4

Convert MP4 to WebM

ffmpeg -i video-raw.mp4 -c:v libvpx -b:v 800k -c:a libvorbis video.webm

Convert MP4 to OGV

ffmpeg -i video-raw.mp4 -c:v libtheora -c:a libvorbis -q:v 6 -q:a 5 video.ogv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment