Multimedia content publishing is at very high levels of popularity. Practically everything we find on the Internet, is composed of images, videos or audios and although GNU/LINUX has always been famous for being an operating system for “geniuses” or “rare”, the truth is that it is very versatile and can also be produced in a variety of ways. FFmpeg is coming to the rescue.
FFmpeg is a suite of open source software in command line that permits managing of audio or video streams. With it, you can make recordings, corrections with filters, or transcode media from one format to an other.
To perform this tutorial successfully, you need first of all, a user with super user privileges, then you must have knowledge about repositories and command line.
Let’s start with Debian 8
In case you have installed Debian 8 Jessie, you should know that FFmpeg is not available from the official Debian repositories, but you have to use the Debian Multimedia repository and install from there.
Adding the deb-multimedia repository
First ,you must edit the file
/etc/apt/sources.list. In that file are the repositories that APT uses. Run, on a terminal:
:~$ sudo -i :~# nano /etc/apt/sources.list
Now add the following lines to that file. It should look like this:
deb http://www.deb-multimedia.org jessie main non-free deb-src http://www.deb-multimedia.org jessie main non-free # jessie-backports deb http://ftp.debian.org/debian/ jessie-backports main
The next step will be to install the deb-multimedia-keyring package to add the GPG keys from the repository. Run:
:~# apt update :~# apt install deb-multimedia-keyring :~# apt update
And finally we proceed to install FFmpeg.
:~# apt install ffmpeg
Now, Debian 9
If we have installed debian 9 in our computer and we want to install FFmpeg, then it is simple because in this version of Debian, it is inside the official repositories, for it is enough with one:
:~# apt install ffmpeg
And now we proceed to verify the installation:
:~# ffmpeg -version
Using FFmpeg. First steps.
First you must understand that FFmpeg runs mainly from the command line interface, i.e. you have to use the terminal. We know that not everyone is comfortable with that, but it’s not difficult. To help with the compression of the tool, we will explain it with some examples:
Displaying usage information on the terminal
To learn how to use a tool, nothing like keeping an eye on official information, for it, write:
:~# ffmpeg --help
Executing the above command, you will get information about how to use it and its multiple configuration options.
Get the information about a video file
Many times you need to know the information of a video, for it, runs on a terminal:
:~# ffmpeg -i file.flv
The result will be something like this:
Convert a video to another format
It is one of the basic tasks in today’s multimedia work. FFmpeg has many and varied conversion options, believe me, they are many but in a more elementary way, it can be done by running:
:~# ffmpeg -i inputvideo.x output.x
Note: .x is pointed out to clarify that the format is variable (mp4, 3gp, mpg, mkv..etc) in both input and output video.
Although it is known that when converting a video to another format, it is possible to lose quality, it is possible to tell FFmpeg to try to have the same quality by adding the -sameq (same quality) option.
:~# ffmpeg -i inputvideo.x -sameq output.x
Mixing an audio file and a video
Imagine that you have a video presentation and you want to put an audio, well it is possible to do it with this command:
:~# ffmpeg -i audio.mp3 -i video.avi video_and_audio.mpg
So far we have seen a few but illustrative examples, however the possibilities are almost limitless.
Bonus: QwinFF a FFmpeg GUI (Debian 9)
Because FFmpeg is a very powerful tool, its possibilities are very wide and not many people are comfortable using the command line interface, so here’s QwinFF.
QwinFF is an open source aplicaciṕn built with C++ and QT4 that aims to simplify the use of FFmpeg by providing a clean and concise graphical interface. Let’s install it. Run:
:~# wget https://launchpad.net/~lzh9102/+archive/ubuntu/qwinff/+files/qwinff_0.2.0-1~wily2_amd64.deb
Once the download is complete, we proceed to install the package dependencies:
:~# apt install libqt4-dbus libqtdbus4 qdbus qtcore4-l10n libdirectfb-1.2-9 libvorbisidec1 libsox-fmt-alsa libsox-fmt-ao libsox-fmt-oss libsox-fmt-pulse libsox-fmt-base libsox2 libqt4-network libqt4-opengl libqtcore4 libqtgui4 sox mplayer qtchooser libqt4-xml libqt4-xml
:~# dpkg -i qwinff_0.2.0-1~wily2_amd64.deb
Now run it:
And that’s it, with this we have finished installing QwinFF. Now we have to discover and use their options.
I hope you liked this article that serves as an introduction to this great tool like FFmpeg. Leave us your comment telling us about your experience.
Please spread this article through your social networks.