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.mp4What each flag does
| -c:v libx264 | Encodes video with H.264 — the codec both platforms decode natively. |
| -crf 23 | Quality target: lower is better quality and bigger files. 18-23 is the useful range for social video. |
| -preset slow | Trades 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 128k | Audio 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.
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 templatesCommon questions
Should I match Instagram's exact bitrate recommendation?+
Does resolution matter more than bitrate for these platforms?+
What about vertical 9:16 video specifically?+
scale=1080:1920.