Skip to content

Instantly share code, notes, and snippets.

@paulmsmith
Last active September 14, 2015 09:07
Show Gist options
  • Save paulmsmith/50e870f8a151667ebd02 to your computer and use it in GitHub Desktop.
Save paulmsmith/50e870f8a151667ebd02 to your computer and use it in GitHub Desktop.
ffmpeg compress MP4s and convert to webm - commands
# install libvpx and ffmpeg
brew install libvpx
brew install ffmpeg --with-libvpx
# convert a single specific file "input.mp4" to webm "output.webm"
ffmpeg -i input.mp4 -c:v libvpx -b:v 1M -c:a libvorbis output.webm
# loop all mp4 files in current directory and convert to webm suffixed with "_compressed"
for file in *.mp4; do ffmpeg -i "$file" -c:v libvpx -b:v 1M -c:a libvorbis "${file%.mp4}"_compressed.webm; done
# compress specific mp4
ffmpeg -i input.mp4 -c:v libx264 -crf 24 -b:v 1M -c:a libvo_aacenc output.mp4
// compress all mp4s in current directory suffixed with "_compressed"
for file in *.mp4; do ffmpeg -i "$file" -c:v libx264 -crf 24 -b:v 1M -c:a libvo_aacenc "${file%.mp4}"_compressed.mp4; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment