Skip to Content

How to Reduce A Video's File Size with FFMPEG

In this tutorial, you'll learn how to reduce a video's file size with very little loss in quality using FFMPEG. We'll discuss what FFMPEG is, how to download and install it in both a Windows and Linux environment, and how to compress your video quickly.

What is FFMPEG?

FFMPEG is an open-source command-line software used for video recording, converting, compression, and streaming across multiple platforms.

In this scenario, we'll be using it for video compression using H.265, also known as High-Efficiency Video Coding, or MPEG-H Part 2, which will reduce the file size of our video files significantly.

Make sure you have FFMPEG installed on your machine. You can follow the installation instructions below depending on your environment.

Install FFMPEG on Windows

If you're using a Windows machine and don't have FFMPEG installed, you can download it from the official FFMPEG website, then run the installation file and follow the instructions.

Install FFMPEG on Ubuntu Linux

To install FFMPEG on a Ubuntu Linux environment, make sure you have all of the latest packages installed first:

$ sudo apt update

Then run the FFMPEG software installation command:

$ sudo apt install ffmpeg

Installation Check

Once installed in either environment, you can run the following command to ensure the installation completes successfully:

$ ffmpeg -version

How to Compress Video with FFMPEG

Open up your command-line tool and browse to the folder where your video is located. In this example, we'll assume your video is named input.mp4 and create a newly compressed version named output.mp4:

$ ffmpeg -i input.mp4 -vcodec libx265 -crf 25 output.mp4

The command console will output the compression results as it progresses through. Once completed, you'll see your current directory with the ability to input another command again.

Now, let's walk through each of the parameters:

  • -i: Used to define our source file for compression. In this case, input.mp4.
  • -vcodec: Used to define the compression and encoding technology. In this case, libx265. H.265 is the current standard, as it compresses more of the video at a higher quality than its predecessor, H.264.
  • -crf: Used to define the Constant Rate Factor or the output quality of the destination video file. These values depend on the encoder you're using, but a lower value indicates a higher quality output. For example, a value of 0 indicates a losses compression, while a value of 50 indicates the worst possible quality after compression.


FFMPEG makes video compression seamless and is an easy software solution to use. Try compression with different CRF values and run a comparison between your before and after videos. Play around and have fun with it!

Last Updated: June 10, 2022
Created: May 22, 2022


There are no comments yet. Start the conversation!

Add A Comment

Comment Etiquette: Wrap code in a <code> and </code>. Please keep comments on-topic, do not post spam, keep the conversation constructive, and be nice to each other.