FFmpeg, is the most powerful tool for multimedia compression, conversion, analysis, and many many more, I believe. For those who are not familiar with the command line interface, FFmpeg could seem daunting initially. But once they overcome that hurdle, FFmpeg becomes their lifelong friend for all multimedia manipulations for its versatility and performance.
In this article, I will scratch the surface of FFmpeg and its related tools (FFprobe and FFplay) by demonstrating how to download, install, compress, convert, play and extract media duration.
FFmpeg works on all operating systems. The download page has executable packages for MacOS, Windows and the various Linux distributions.
There are also static builds (stand-alone executables with all dependencies packaged) for the different operating systems.
For starters, I suggest downloading a standard executable for your operating system. This will install FFmpeg and all related tools such as FFprobe and FFplay.
To start using the toolset, you need to open a command line interface within the Operating system you use. On MacOS and Linux, you can search for terminal and on Windows, search for CMD.
FFmpeg can convert between different multimedia file formats. The command below illustrate a simple conversion of a video file from MKV to MP4.
ffmpeg -i example_file_input.mkv -c copy example_file_output.mp4
Replace “example_file_input.mkv” and “example_file_output.mp4” with your input and desired output file names.
FFmpeg can significantly reduce the size of media files while retaining quality at an incredible level. I have seen over 86% reduction in video files sizes while video quality remained intact.
The sample command below will compress an MP4 input file:
ffmpeg -i example_input.mp4 -vcodec libx264 -crf 20 example_output.mp4
Replace “example_input.mp4” and “example_output.mp4” with your input and desired output file names
FFplay can easily play all types of multimedia files using a very simple command:
Replace “input_file” with the multimedia file you want to play.
In advanced applications such as YouTube and other multimedia content platforms, the length of an audio or video file is indicated on thumbnails or in previews, to provide information about multimedia content before one even interacts with them. This extraction of multimedia length can easily be done with FFprobe.
The command below demonstrates this:
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -sexagesimal input_file
Replace “input_file” with your file name.
To understand the different options used, read the detailed FFMPEG documentation online.
I believe you been introduced to FFmpeg and its related tools. You have also been provided with a few very useful commands to start leveraging this versatile toolset for multimedia manipulations.
If you have any questions and comments, please leave them below and I will be glad to reply to them.