Today while exploring ways to reduce video file size, we at SpadeBee came across a stunning method. Using FFMPEG, we reduced the file size of a 720p video from 1.7 GB to 67 MB without changing resolution or any quality loss!
FFmpeg is a free and open-source project consisting of a vast software suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the FFmpeg program itself, designed for command-line-based processing of video and audio files, and widely used for format transcoding, basic editing (trimming and concatenation), video scaling, video post-production effects, and standards compliance (SMPTE, ITU). [source: FFMPEG Wikipedia]
If you don’t already have FFmpeg installed to your machine please refer to our guide on How to install FFmpeg.
How it is done?
The ultimate compression is done by changing the video codec of your video.
A video codec is an electronic circuit or software that compresses or decompresses digital video. It converts uncompressed video to a compressed format or vice versa. In the context of video compression, “codec” is a concatenation of “encoder” and “decoder”—a device that only compresses is typically called an encoder, and one that only decompresses is a decoder.
We shall be changing your codec to HEVC/H.265. In comparison to AVC, HEVC offers from 25% to 50% better data compression at the same level of video quality, or substantially improved video quality at the same bit rate.
So let’s get compressing your video by following steps:
- Open up your command prompt/terminal/termux depending upon your OS.
- Check if ffmpeg is installed by following command
It should be something like:
If it’s not, your ffmpeg is not installed properly. Follow our guide to install FFmpeg properly.
- Next thing we need to do is to use the following command:
ffmpeg -i <input file> -c:v libx265 -crf 28 <output file>
where <input file> and <output file> are your paths to input and output files respectively.
ffmpeg -i spadebee.mp4 -c:v libx265 -crf 28 newspadebee.mp4
The process may take time depending upon your video length and your computer specs.
- Checking results:
- Checking results:
So here we compressed the file significantly.
Drop down your queries and ideas in comment section about video compressions!