FFmpeg · Command Guide

How to Compress a Video for Instagram or TikTok With FFmpeg

Both platforms re-compress everything you upload anyway — the goal isn't to hit their exact spec, it's to hand them a file that's already small and clean so their compression pass doesn't have to work as hard, which is what causes visible quality loss.

Both platforms re-compress everything you upload anyway — the goal isn't to hit their exact spec, it's to hand them a file that's already small and clean so their compression pass doesn't have to work as hard, which is what causes visible quality loss.

The command

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset slow -vf "scale=1080:-2" -c:a aac -b:a 128k output.mp4

What each flag does

-c:v libx264Encodes video with H.264 — the codec both platforms decode natively.
-crf 23Quality target: lower is better quality and bigger files. 18-23 is the useful range for social video.
-preset slowTrades encoding time for better compression efficiency at the same quality — worth it for a one-time export.
-vf "scale=1080:-2"Resizes to 1080px wide, height auto-calculated and rounded to an even number (required by H.264).
-b:a 128kAudio bitrate — 128k is plenty for speech and most music, well under what either platform needs.

Where this goes wrong

Setting CRF too low (below 18) to chase quality just produces a huge file that the platform re-compresses anyway, throwing away the extra data you paid encoding time for. CRF 20-23 with -preset slow consistently looks better after platform re-compression than CRF 15 with a fast preset.

After the command

Compression is the last step before upload — after the edit is done, not instead of it. NULLFRAME's templates handle the structure and motion first; export settings like these are what you run on the finished render.

See the templates

Common questions

Should I match Instagram's exact bitrate recommendation?+
Not necessary — CRF-based encoding already targets a sensible file size for the quality level, and the platform re-encodes on ingest regardless.
Does resolution matter more than bitrate for these platforms?+
Roughly equally — oversized resolution wastes bits on detail that gets discarded, undersized resolution looks soft after their upscale.
What about vertical 9:16 video specifically?+
Same command, just swap the scale filter to your target vertical resolution, e.g. scale=1080:1920.