How to reduce video file size with FFMPEG from Linux Terminal
Saving videos on personal storage, cloud services, or drives can be difficult when space is limited. Reduce the file size to help store larger files, and continue to increase the number of files in the collection easier. Some methods of doing this are more effective than others.
There are many tools to choose from in the field of video processing, capable of optimizing file size. However, many of these options - including VLC, Cinelerra and Blender - share the same tool behind the user interface - a command-line utility called FFMPEG. Today's article will show you how you can reduce the video file size with FFMPEG from the Linux terminal.
What is FFMPEG?
FFMPEG is arguably the most fully featured command line utility in the Linux software ecosystem. Among a host of great features, this tool can handle creating GIFs, cutting / editing and recording videos.
Most importantly, FFMPEG can convert videos at a surprising rate, allowing quality to be maintained at a high level, while file size is halved (or even a quarter of a few). case).
Setting
Installing FFMPEG in Ubuntu is very simple. Please execute the following command:
sudo apt install ffmpeg
When the installation process finishes, you are ready to begin.
Use
Using FFMPEG is also very simple as follows:
ffmpeg -i input.video output.video
However, to really reduce the size of the video file in an optimal way, you need to consider the properties of certain file extensions.
Equation optimization
When it comes to video files, not all are created equal. For example, avi file extensions tend to be much larger than mp4 files .
This leads to the logic built into the intended container environment, but can be modified by choosing the appropriate codec to encode files, prioritizing quality at large sizes, or portability with smaller sizes. .
It is worth mentioning that the size of a particular video in mp4 format will always be smaller than the avi format of the same video, but there is a change in size and quality between these file types.
Interestingly, though, mp4 is not the most perfect small file format. The current 'champions' of quality video file types are different containers, available for Flash Video and Windows Media Video (FLV and WMV). Here is part of the simple equation that we can use to get very small but high quality video files:
Small container + Effective Codec + Low Fps + Low Bitrate = Small / high quality video file
Note : For the purposes of this article, "high quality" means discoloration or pixelation (created by displaying a bitmap or part of a bitmap in such a large size that it is visible. the individual pixels, the single colored small square display elements including the bitmap) are at least visible.
Loss of quality is inevitable to some extent, if you really want to optimize the file size. However, how this affects depends on what you are optimizing. Movement speed, color diversity and audio quality / density play a part in determining the level of action for the settings.
The options are rich in the video and container codec world, so we'll keep things simple using WMV 8. (FFMPEG doesn't fully support WMV 9).
Optimize videos
When running FFMPEG, it will convert your input video to the specified file type, using parameters set with special flags. Here is the example code:
ffmpeg -i input.mp4 -b 1000k -vcodec wmv2 -acodec wmav2 -crf 19 -filter:v fps=fps=24 output.wmv
The above code converts the example input file into a file with a bit rate of 1Mbps, a frame rate of 24fps, CRF (Constant Rate Factor) of 19 and the extension .wmv. Change 'input.mp4' to suit your needs and adjust the -crf value to a higher number for smaller file sizes (with lower gradual quality).
FFMPEG is powerful enough to do much more than the things mentioned here. Its complete set of features is impressive and there are many ways other than video conversion. Check the project's official website for more information at:
https://ffmpeg.org/
You should read it
- How to use the FFmpeg command to process audio and video on Linux
- How to reduce the size of JPG files in Windows 10
- How to Reduce PDF File Size
- Tips to reduce the size of PowerPoint files should be known
- How to Reduce Video Size
- How to reduce PDF file size by software
- How to reduce the size and size of Word document files containing images
- How to Install FFmpeg on Windows
May be interested
- 5 ways to reduce audio file size easily and effectivelythis article will show you some effective and easy ways to reduce the size of audio files to help manage easier.
- Top 7 best Linux terminal emulatorsterminal is pre-installed in most linux distributions. however, you may not get as many customization options and advanced functionality with the default option.
- How to Reduce PDF File Sizethis article explains how to reduce pdf file size on windows or mac computers. if you want to use a free online tool, try smallpdf or adobe acrobat's online file compression tool. you can also reduce pdf file size using preview for macos and adobe acrobat pro.
- How to back up and restore Linux Terminal historylinux maintains a backup of the command lines used in the terminal. this guide shows you how to back up a linux terminal history file. then show you how to restore those backups.
- Tips to reduce the size of PowerPoint files should be knownpowerpoint presentations often contain multiple photos, embedded videos, charts, graphs and other content, so it's not surprising that powerpoint files are often large. here are some tips to help you reduce the size of powerpoint files.
- How to reduce PDF file size by softwarereducing the size of pdf files will make file sharing much more convenient, the file size is significantly reduced while the quality of file content remains the same.
- How to reduce the size and size of Word document files containing imagesthe following article details how to reduce the size of word documents 2016, 2010, 2007 containing images without using additional software.
- Compress PDF files, reduce PDF size extremely quicklyreducing pdf file size or compressing pdf files will help you save hard drive space and send files via email more easily. below are 3 ways to reduce pdf file size for you to refer to and choose the right tool for yourself.
- How to Install FFmpeg on Windowsthis is an article on how to install ffmpeg on a windows 10 computer. ffmpeg is a command line program that allows you to convert video and audio into another format, along with recording and recording live.
- How to reduce the file size Cadthe size of the cad file is so large that you cannot share it via social networking sites, email. in the article below, tipsmake.com instructs readers how to reduce the size of cad files to reduce the storage space on the hard drive and easily share via social networking sites, email.