~$ ./jackson.sh

The correct configuration options to compress videos for the web with ffmpeg

Published Sunday, April 11, 2021

Why isn't my encoded video playing in modern browsers?

The motivation of this post is to document the command-line options that worked for me to reduce the size of .mp4 files prior to publishing them on the web. Here they are!

ffmpeg -i input.mp4 -vcodec h264 -acodec aac -strict -2 -crf 30 out.mp4

This output of this command is compatible with all modern browsers (Chrome, Firefox, Safari) and even works in IE11! The -crf 30 flag tells ffmpeg to compress the output as much as possible, you can reduce the number for higher quality.