Still ready to switch to Free Software for your mulitmedia creations?
Let’s start with understanding the files and formats that we are going to manipulate in our workflow.

Codecs and Formats

When it comes to multimedia creation and publishing, using the right format, the right codec, converting, scaling, compressing, can be a real pain. Thankfully, in the world of Freedom, we have some of the best tools to help us manipulate media files and avoid a lot of frustration.

By the way, what’s a Format? And what’s a Codec?

You may wonder what’s the difference between a format and a codec? Well see it as the format being the container of the entire media file’s data representing both audio and video, and the codec being the way to encode and decode this data. The same format can hold data described by different codecs. Also a codec can be used with different formats.

As an example, the Matroska (.mkv) format can store either H264 or Theora encoded video and Opus or FLAC audio. Now the OGG format, can also hold Theora video and Opus or Vorbis audio… Is this making sense?

These are just examples but I have to admit that there are so many different formats and codecs that it is very difficult to see clear sometimes. What I suggest is to use only a few formats and codecs. The ones we really need. I will come back to this point in a future article.

FFmpeg

FFmpeg is a command line based software that manipulates formats and codecs. Many free software already rely on FFmpeg so you may not need to ever use the commands directly but if you are comfortable with the terminal, FFmpeg can be very useful for quick conversions.

I will cover the basic usage of FFmpeg in this post.

If don’t like using the terminal or don’t easily remember commands (just like me), don’t worry, I will cover media conversions with a clean GUI, in a future post.

Installing FFmpeg

FFmpeg being very popular is pretty easy to install and should be directly available in the most common GNU/Linux distributions repositories.

When using PureOS, FFmpeg should be installed by default but if it is not the case, just use the following command in a terminal :

sudo apt install ffmpeg

Using FFmpeg

In order to get a list of formats supported by FFmpeg, open up a terminal window and type the following command :

ffmpeg -formats

And for a list of supported codecs, type the following command :

ffmpeg -codecs

As you can see, the list is quite impressive! FFmpeg can manipulate the most common free and proprietary digital audio and visual formats.

Converting a video can be achieved by a simple command line :

ffmpeg -i input.mov output.webm

This command converts a Quicktime .mov file to a .webm format with the default encoders (keeping the same scale, framerate and bitrate).

If you need to use a specific codec’s encoder for the chosen format just specify it in -vcodec (for video) and -acodec (for audio):

You may also use -minrate and -maxrate to control the minimum and maximum bit rate tolerance (in bits/s)

These are the conversions that I use the most and represent a very short part of the real potential of FFmpeg. There are many more options and filters so if you want to know more about it, I suggest you browse the FFmpeg documentation.

Coming next, will be a tutorial on media conversion using the great GUI from Kdenlive. To complete this series of articles about media files manipulation, I will share with you the different free formats, codecs and params that I use in my entire video production workflow.

Stay tuned! 😉

One last thing…

As you were patient enough to read this article till the end, here is a little present. It is a script that I use to quickly convert short videos animations to animated GIFs.
This script generates a good quality GIF that is scaled down to 640px wide and ready to be embedded in any webpage. I found it in this excellent tutorial.