This site contains affiliate links. If you make a purchase, we may earn a commission.

How To Compress Videos using FFmpeg (5 Methods)

Ezriah Zippernowsky
January 12 2024


Welcome to the jungle of digital file sizes, where we monkeys are always busy peeling and squashing! If you’re going bananas over large video files, don’t fret! This guide will teach you how to use FFmpeg, a mighty tool in the tech wilderness, to compress those chunky videos. It’s perfect for all the curious monkeys out there who haven’t ventured into the world of video compression yet. Let’s not monkey around anymore – it’s time to zip those files down to size!

Table of contents

How To Install FFmpeg

  1. Download FFmpeg: Visit the FFmpeg website and download the software for your Windows/Mac/LINUX. Here’s how to do it for Windows. How To Install FFMPEG GUIDE: Step 1 How To Install FFMPEG GUIDE: Step 1 How To Install FFMPEG GUIDE: Step 1
  2. Installation Procedure: Follow the simple installation instructions. How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2 How To Install FFMPEG GUIDE: Step 2
  3. Check Installation: Open command prompt and type in “ffmpeg”. If you see similar output in the image below, It means you have successfully installed ffmpeg to your computer. Congratulations! How To Install FFMPEG GUIDE: Step 3

How To Compress a Video with FFmpeg

Once you have FFmpeg installed, it’s time to squash those video files!

  1. Open Terminal or Command Prompt: This is like the jungle gym where all the command line magic happens. How To Compress a Video with FFMPEG: Step 1
  2. Navigate to Your Video: Use the cd command to swing to the directory where your video is. For example: cd Downloads. How To Compress a Video with FFMPEG: Step 2
  3. Run the Compression Command: Here’s where the fun begins. Use this simple spell: ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4. Replace input.mp4 with your video’s name and output.mp4 with what you want the compressed file to be called. ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 Here’s a breakdown of what each part of the command means:
  • ffmpeg: This is the command to invoke FFmpeg.
  • -i input.mp4: This specifies the input file, in this case, input.mp4.
  • -vcodec h264: This part of the command sets the video codec for the output file. h264 is a popular video compression standard, known for its high compression efficiency and good video quality.
  • -acodec mp2: This specifies the audio codec for the output file. mp2 stands for MPEG-1 Audio Layer II, which is a standard for the compression of audio signals. It’s an older audio format that predates more modern codecs like AAC and MP3 but is still used in some contexts for its compatibility and decent sound quality.
  • output.mp4: This is the name of the output file, which in this case will be encoded with the H.264 video codec and MP2 audio codec. How To Compress a Video with FFMPEG: Step 3 How To Compress a Video with FFMPEG: Step 3
  1. Wait for the Magic: Watch as FFmpeg performs its voodoo – compressing your video! This might take a bit, like waiting for bananas to ripen. How To Compress a Video with FFMPEG: Step 4 How To Compress a Video with FFMPEG: Step 4

How To Customize Compression Using Bitrate

Tweak the video quality and size by adjusting the bitrate, a real monkey’s wrench in your toolbox!

  1. Choose a Bitrate: Use the -b:v option to set a video bitrate (like 500k for 500 kbps). Lower bitrates mean smaller files but lower quality. It’s all about finding the right balance between size and quality. ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 -b:v 500k output.mp4 How To Customize Compression Using Bitrate: Step 1 How To Customize Compression Using Bitrate: Step 1 How To Customize Compression Using Bitrate: Step 1 How To Customize Compression Using Bitrate: Step 1

How To Customize Compression by Adjusting Resolution

Sometimes you need to trim the tree to fit your jungle. Let’s adjust the video resolution!

  1. Scale the Resolution: Use -vf “scale=1280:720” to change the resolution. This is like finding the right branch to swing from – not too high, not too low! ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 -vf "scale=1280:720 output.mp4 How To Customize Compression by Adjusting Resolution: Step 1 How To Customize Compression by Adjusting Resolution: Step 1 How To Customize Compression by Adjusting Resolution: Step 1 How To Customize Compression by Adjusting Resolution: Step 1

How To Customize Compression by Modifying Audio Bitrate

Let’s not forget the rhythm of the jungle – the audio! Fine-tune it to your liking.

  1. Adjust the Audio Bitrate: With -b:a, you can set the audio bitrate. This is like tuning your jungle drums to the perfect beat! ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 -b:a 500k output.mp4 How To Customize Compression by Modifying Audio Bitrate: Step 1 How To Customize Compression by Modifying Audio Bitrate: Step 1 How To Customize Compression by Modifying Audio Bitrate: Step 1 How To Customize Compression by Modifying Audio Bitrate: Step 1

Conclusion

Now, you’re ready to swing through the digital jungle with your newly compressed videos. Remember, in the world of file sizes, being a bit smaller can mean a lot more room to play. Go ahead, compress those videos, and enjoy swinging from tree to tree with a lighter load!