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
- 7 great Linux distro media centers for HTPCif you are looking for an outdated linux media center or an alternative to kodibuntu, try the following open source htpc operating systems.
- How to scan malware and rootkits on Linux serverthere are many tools to help scan linux servers for malware and rootkits. this article will provide some of the best options to help deal with these cyber-enemies.
- Compare 2 websites to download Linux Flathub and Snap Store applicationsflathub and snap store are two websites that have developed around two separate universal package formats for linux: flakpak and snap.
- How to monitor Nvidia GPU performance on Linuxeven when using the best linux distribution for gaming, you still have gpu performance problems if not configured correctly. check the graphics card management tools below to determine if the gpu has a problem.
- How is Mobile Linux different from Desktop Linux?next year may be the 'year of the linux operating system for desktop', but mobile operating systems will not sit still waiting.
- 8 port scanning tools for Windows / Linux systemsport scanning is an important factor when you want to consider security aspects for any remote or local network.