How to Reduce Video File Size with FFmpeg (Command-Line)
In the trend of HD and 4K, videos seems to get larger and larger, while the Internet bandwidth and our hard drives don't always match with the big size. Thus users are trying to reduce video size while converting the video format. FFmpeg, an open source free video transcoder, can make this done indeed. But this tool is command-line only, which means it doesn't have a graphical, clickable interface. Therefore, it's difficult to get to know how to use FFmpeg for video compression.
In this article, we'd like to show you how to use FFmpeg to compress video size without sacrificing (much of) its quality on Windows (Windows 11 included) PCs, also the best FFmpeg alternative to reduce video size without quality loss in a more effective way.
- Part 1: How to Compress Video Size with FFmpeg (Command-line)
- Part 2: Best FFmpeg Alternative to Reduce Video Size without Losing Quality
Strapped for time? Click one of the links below to jump straight to your most interested part.
Part 1: How to Compress Video Size with FFmpeg (Command-line) on Windows
To compress videos in FFmpeg, you should make sure the command-line is right. Start with the command-line examples below using FFmpeg.
Step 1. Install FFmpeg on Windows
Download FFmpeg and finish the setup process on your computer. For Windows users, Windows Powershell is recommended over Command-Line. Open Windows Powershell from the start menu, and start with the compression command-line in FFmpeg. For more detailed guide, check for this post "How to Install FFmpeg on Windows".
Step 2. Input video compression command-line
There are a few ways to reduce video size using FFmpeg. You can use a more efficient codec format (H.265 compresses data 30% smaller than H.264), lower bitrate or fps, shorter video length. Here we take some typical command-line examples to show you how to compress MP4/MOV/4K/MKV video size using FFmpeg.
Command-line - Compress and Convert H.264 to H.265 for Higher Compression
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
Command-line - Compress and Convert MP4 to Webm for YouTube, Ins, Facebook
ffmpeg -i source.mp4 -c:v libvpx-vp9 -b:v 0.33M -c:a libopus -b:a 96k \
Command-line - Compress and Convert MP4 to WMV
ffmpeg -i input.mp4 -b 1000k -vcodec wmv2 -acodec wmav2 -crf 19 -filter:v fps=fps=24 output.wmv
Command-line -Set CRF in FFmpeg to Reduce Video File Size
ffmpeg -i input.mp4 -vcodec libx264 -crf 24 output.mp4
Command-line - Reduce video frame size to make 4K/1080P FHD video smaller
ffmpeg -i input.avi -vf scale=1280:720 output.avi
To make the command line clearer, below are what some common FFmpeg command-line options specify, including -c:v, -b:v, -c:a, -b:a, CRF. These options are frequently used for reducing video size in FFmpeg.
-c:v: video codec
-b:v: video bitrate
-c:a: audio codec
-b:a: audio bitrate
-filter:v: a filter to video stream
-f is used to explicitly specify the container format, -f mp4, -f wmv, -f webm, etc.
CRF (Constant Rate Factor): set the CRF to lower the bit rate but retain better quality. The lower crf, the higher the bitrate. According to test, setting crf to 24 reduce a 250MB video to 70MB without losing the quality noticeably. Use ffmpeg -i input.avi -vcodec libx264 -crf 24 output.avi, a 1GB video can be compressed to 200MB.
Step 3. Start reducing video file size in FFmpeg
Hit enter and the video compression process should begin. Now, FFmpeg is running to do the video compression job. The video processing progress is showing at the bottom. Tips: compressing 4K UHD videos in FFmpeg is CPU intensive, you'd better shut down other programs running background on your device.
Step 4. Done!
When the video compression completes, the output video file should appear at your specified location. Check for the output video file size and figure out the FFmpeg video compression ratio.
Part 2: Best FFmpeg Alternative to Reduce Video Size without Losing Quality
For many novice users, FFmpeg is not easy to get started. To make your video compression easier and more efficient, you can adopt EaseFab Video Converter for help. It's a 100% clean and safe software to fullfill common video compression and conversion needs, especially for those newbies who are not skilled with software or computer. It is simple in interface but comprehensive in functionality. Here, as a superb video compressor for Windows and Mac, it can help downsize videos including but not limited to MP4, MKV, WMV, MOV, M4V, MTS, etc. up to 4K quite easily by changing the 3 elements, say adjusting video parameters, converting coding format and cutting unwanted parts being the factors that determines the size of a video file. Which makes it better than other video compressors out the market including FFmpeg, HandBrake and VLC. So, let's take a look at how it shrinks video file size.
Step 1. Free download EaseFab Video Converter on Windows or macOS, install and launch it on your computer.
Step 2. Click on "Add Video" button on the main UI to add an video you want to reduce the file size.
Step 3. Set the parameters that determine the size of a video.
EaseFab Video Converter provide 3 common ways to help you compress MP4 video size. Below, we'll explain the details on how to do these.
Option ① - Reduce Video File Size with Advanced Settings
Video and audio files have their own codecs, which make them different from other files in size. When we want to reduce MP4 file size, we can also change the codecs of the video file to make the file smaller. Speaking of changing the codecs, we're mainly talk about changing bit rate, resolution or frame rate of the video file. Therefore, if you want to reduce video file size, you can click "Settings" button to adjust video audio parameters, for example, downscale 4K resolution to 1920×1080 pixels, lower video frame rate, bit rate, or change aspect ratio and so on.
Changing Bitrate: The size of the video file can be decreased by lowering its bitrate. Bit rate size is directly proportional to file size, and thus, reducing one will reduce the other as well. But here it needs to be understood that too much lowering of the bit rate will reduce the quality as well. Thus reducing the bit rate by 20-30% of the original size is a good choice.
Changing the resolution of the file: The resolution of any file determines its size as well as quality. A high-resolution file will have good quality and larger file size. Thus, if you are aiming to reduce file size, reducing the resolution with a video resolution reducer will do the trick. If you have HD videos with a high resolution of 1080P, you can reduce it to a lower resolution to reduce the file size.
Changing frame rate: Another aspect that can be considered while reducing MP4 file size is to reduce the frame rate of the file. The frame rate is directly related to file size, and thus, reducing one will directly affect the other.
Option ② - Compress videos by Trimming and Cropping Unwanted Part of Video
Another solution to reduce the size of the video file is by trimming and cutting its unwanted parts. To do this, you can click the pencil-like "Edit" button and swith to "Trim" tab to cut unwanted segments of your video. For details, go to guide of how to trim video to learn more.
Option ③ - Shrink MP4 videos by converting it a lighter format
You can click "Format" bar and find "Common Video" and then select HEVC MP4 as the output format as HEVC coding format has higher compression ration.
Step 3: Compress your video file now!
When everything is OK, you can simply hit "Convert" button to start compressing your video with this video compressor.
Other Useful How-to Guides & Tips
This article introduces three ways to reduce the size of MP4 video files by reducing resolution, video and audio bitrate or converting MP4 to other formats as you like.
Here're 3 methods to convert 4K video from HDR to SDR in 1080p/4K for free on Windows (10) or Mac. Learn how to transcode HDR to SDR without quality loss using Handbrake, FFmpeg and EaseFab Video Converter.
Here you will find the "Why" and how to downscale 4K to 1080P (in smaller file size, unaffected visual quality) with VLC, online converter, and EaseFab.
Follow this article to find out why we need to convert 1080p to 4K and how to easily upscale 1080p to 4K with a third-party 4K upscaling tool.