As I Solve

Bulletproof solutions for the savvy developer.

FFMPEG encoding settings for web video


Choice settings for web video in 3 formats (fallbacks for various browsers)

MP4

ffmpeg -i [path-to-video] -vcodec libx264 -preset slow -profile main -crf 25 -acodec aac -ab 64k [new-video-name].mp4

Adjust the crf and ab settings to suit your quality/size needs. crf is inversely related to the quality (0 is best).

WebM

ffmpeg -i [path-to-video] -codec:v libvpx -quality good -cpu-used 0 -b:v 500k -qmin 10 -qmax 42 -maxrate 500k -bufsize 1000k -threads 4 -vf scale=-1:480 -codec:a libvorbis -b:a 128k [new-video-name].webm

Adjust quality to suit your needs: best, good or realtime.

OGV

ffmpeg -i [path-to-video] -vcodec libtheora -qscale 5 -acodec libvorbis -ab 128k [new-video-name].ogv

Adjust Qscale to suit your needs – 10 is highest quality, 0 is lowest.


Leave a Reply