Compress a video for the web

Re-encodes with a quality target and web-friendly flags, which is what makes a file both smaller and playable everywhere.

ffmpeg -i https://cdn.rendobar.com/assets/examples/sample.mp4 -c:v libx264 -crf 26 -preset medium -c:a aac -b:a 128k -movflags +faststart -t 5 out.mp4
Encode
896 ms
Output
419.1 KB
Cost
$0.0022
Result
1280x720

job_5455f4f702864327

The part everyone gets wrong

-movflags +faststart is the difference between a video that streams and one that must fully download first. It costs a second pass over the file and nothing else. Every MP4 destined for a browser should have it, and most compression guides never mention it.

What the common version does

Without +faststart the moov atom sits at the end of the file, so a browser must download the whole thing before playback starts.

ffmpeg -i https://cdn.rendobar.com/assets/examples/sample.mp4 -c:v libx264 -crf 26 -preset medium -c:a aac -b:a 128k -t 5 out.mp4
It succeeds, and that is the problem

It did not error. It produced 419.1 KB against the correct command's 419.1 KB, a 1.0x smaller file. A pipeline would accept this silently.

job_3b20cb2ab35541a0

Frequently asked questions

How do I compress video ffmpeg?

Re-encodes with a quality target and web-friendly flags, which is what makes a file both smaller and playable everywhere.

What goes wrong most often?

-movflags +faststart is the difference between a video that streams and one that must fully download first. It costs a second pass over the file and nothing else. Every MP4 destined for a browser should have it, and most compression guides never mention it.

What happens if I get it wrong?

We ran the naive version too. It did not error. It produced 419.1 KB against the correct command's 419.1 KB, a 1.0x smaller file. A pipeline would accept this silently.

Do I need FFmpeg installed?

Not with Rendobar. The command on this page ran through the API against a URL, with no local FFmpeg and no server. The job id below it is the job that produced these numbers.

Run this without installing FFmpeg

This exact command ran through the API against a URL.