Converting videos to different formats, sizes, qualities, cropping, trimming, adding intros and outros, watermarking, adding subtitles and a long list of day to day opeations are at your finger tips with a few terminal commands and the right tools to use.

For sure, the best and most used tool for video operations is FFMPEG, a more than 20-years old open-source tool that continues to be your best companion for these tasks.

What FFMPEG is?

FFMPEG is an open-source multimedia framework that can be used for recording, converting, and streaming videos. FFMPEG is a command-line program that runs in a console and has no user interface. This is a showstopper for many potential users that do not feel comfortable using a console window, and certainly FFMPEG is not the easiest and user-friendly software you will find.

On the bright side, it is free to use and install on Windows, MacOSX, GNU/Linux, Android etc. And this makes it a first-option for many higher-level software that use FFMPEG in the background.

What FFMPEG can do?

The list is so extense that it would probably be easier to answer what it can't do, but just as matter of examples this is a list of the most common uses cases for FFMPEG:

As said, the list could have 100+ items and it won't be complete, so you probably can assume that anything you imagine can be probably done with FFMPEG in some way.

FFMPEG installation

To use FFMPEG you need to install it on your computer or on a server. There are ready-to-use versions of FFMPEG for the most common platforms like Windows, MacOSX and Linux, or if you have special needs you can compile FFMPEG from its source code.

Read the HOW-TO guide on How to install FFMPEG on your computer.

FFMPEG tools suite

FFMPEG comes with 3 command-line tools:

In this course you will learn how to use ffprobe and ffmpeg but I will use (and recommend) playing the videos with VLC or Quicktime.

How to use FFMPEG

As previously said, FFMPEG is a tool with no Graphical User Interface (GUI) that receives parameters as input and generates files as output.

FFMPEG can be used in several ways:

You must choose what is the best way for you based on your use case and for simplicity in this course we will use command-line parameters.

FFMPEG command-line structure

FFMPEG uses a quite strict and particular structure for receiving parameters that it's pretty simple in concept but that gets quite complicated to read as you add more and more parameters.

The basic command-line structure is:

ffmpeg [global-options] [[input-options] -i [input-file]] [output-options] [output-file]

Note: there can be any number of input sources, with their preceded input-options.

Example:

ffmpeg \
    -y \
    -loop 1 -t 2 \
    -i image.png \
    -pix_fmt yuv420p -vcodec libx264 \
    output.mp4

Self-evaluation

What sentence below better defines what FFMPEG is?

How video and audio files are organized?

The codec defines the way the stream is compressed

Transcoding is the action of...

Published on February 2nd, 2022

Author
Bernat Guitart
Bernat Guitart I have spent my whole life working on the Internet. First as a Developer and moving on to being a Product Manager, COO and a Digital Marketing Manager. I am now the CEO of a full-fledged Internet company, developing product and implementing our whole online eCommerce strategy.