Ever tried sharing a video and been hit with the dreaded message: “File too large”? You’re not alone! Whether you’re uploading to YouTube, sending via email, or just saving space on your device, big video files can be a pain.
But don’t worry. There’s a powerful tool called FFmpeg that can help. Even better, you can reduce the file size without making your video look like it was shot with a potato.
In this article, we’ll explore how to shrink your videos using FFmpeg while keeping that sweet high quality intact. It’ll be simple, fast, and yes—actually kind of fun.
FFmpeg is a free and open-source command-line tool. It’s like a Swiss Army knife for video and audio files. You can use it to convert files, extract audio, merge clips, and—you guessed it—compress your videos.
Best of all, it’s lightning fast and works on Windows, macOS, Linux… pretty much everything.
If you haven’t installed it yet, you can download it from the official site: https://ffmpeg.org/download.html
When we talk about “quality,” we usually mean resolution, sharpness, and smoothness. We want our videos to stay crisp without killing our hard drive or mobile data.
Lossless compression would be ideal, but sometimes we just want visually lossless results—meaning it looks just as good to the human eye.
And that’s where FFmpeg swoops in like a compression superhero.
Ready for some FFmpeg magic? Open Terminal (macOS/Linux) or Command Prompt (Windows), and let’s type some commands.
Here’s a simple one to get you started:
ffmpeg -i input.mp4 -vcodec libx264 -crf 23 output.mp4
Let’s break it down:
Go ahead and run that if you’re feeling adventurous. But don’t go away—we’ve got more tricks up our sleeve!
You can control how much quality you’re willing to trade for size. Here’s how:
CRF (Constant Rate Factor) is your BFF. Want higher quality?
-crf 18
Want a smaller file?
-crf 28
The magic is finding the balance. Try starting around 23 and adjusting up or down based on your needs.
FFmpeg offers presets like ultrafast, superfast, veryfast, and so on up to veryslow.
Example:
ffmpeg -i input.mp4 -vcodec libx264 -preset slow -crf 23 output.mp4
The slower the preset, the better the compression efficiency. It will take more time, but shrink your video more.
If your video doesn’t need sound (hello, silent tutorials?), toss it out:
ffmpeg -i input.mp4 -an -vcodec libx264 -crf 23 output.mp4
-an just removes the audio stream. Simple and effective.
Resolution takes up a lot of space. Do you really need 4K for that birthday video of your cat?
You can scale it like this:
ffmpeg -i input.mp4 -vf scale=1280:-2 -vcodec libx264 -crf 23 output.mp4
The -vf scale=1280:-2 part resizes your video to 1280 pixels wide—height is adjusted automatically to keep aspect ratio.
Common sizes:
Pick what makes sense based on where you’ll be posting the video.
Sometimes, it’s not just video hogging the space. Audio counts too! You can reduce the audio bitrate without a big quality hit:
ffmpeg -i input.mp4 -b:a 128k -vcodec libx264 -crf 23 output.mp4
-b:a 128k sets the audio to 128kbps—a good default for speech and general use.
Want to scale, reduce audio bitrate, and compress all at once? Here’s your dream combo:
ffmpeg -i input.mp4 -vf scale=1280:-2 -c:v libx264 -preset slower -crf 22 -c:a aac -b:a 128k output.mp4
This command:
Cool, right?
Want to see the difference? Try this:
du -h input.mp4
du -h output.mp4
The du -h command shows file sizes. Spoiler alert: your new video is way smaller.
Got a folder full of giant videos? Compress ’em all with a short script.
Here’s an example for macOS/Linux:
for f in *.mp4; do ffmpeg -i "$f" -vcodec libx264 -crf 23 "compressed_$f"; done
On Windows, you can use a batch (.bat) script instead.
Congrats! You’ve just learned how to slim down your video files like a pro. With a bit of tweaking, FFmpeg can save tons of space without making your video look fuzzy or pixelated.
From adjusting CRF to smart resizing and cautious audio tweaking—you’ve got all the tools you need.
Remember: Play around. Experiment. View the results. Soon, you’ll find the sweet spot that works perfectly for your projects.
Happy compressing! 🎉