How to Install and Use FFmpeg on Debian 9
3 min read
FFmpeg is a free and open source command line tool for transcoding multimedia files. It contains a set of shared audio and video libraries such as libavcodec, libavformat, and libavutil. With FFmpeg, you can convert between various video and audio formats, set sample rates and resize videos.
This tutorial explains how to install FFmpeg on Debian 9.
You’ll need to be logged in as a user with sudo privileges to be able to install packages on your Debian system.
Installing FFmpeg on Debian
The official Debian repositories contain FFmpeg packages that can be installed with the
apt package manager. At the time of writing this article, the current version of FFmpeg available in the Debian 9 repositories is
The following steps describe how to install FFmpeg on Debian 9:
Start by updating the packages list:
sudo apt update
Install the FFmpeg package by running the following command:
sudo apt install ffmpeg
Validate the installation by running the
ffmpeg -versioncommand which will print the FFmpeg version:
The output should look something like the following:
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
To print all available FFmpeg's encoders and decoders you can use:
ffmpeg -encoders ffmpeg -decoders
That's it. FFmpeg is now installed on your system and you can start using it.
The version included in the Debian repositories always lags behind the latest version of FFmpeg. If you want to install the latest version of FFmpeg you'll need to build the FFmpeg tools from source.
In this section, we will show you some examples of how to use the
When converting audio and video files with
ffmpeg you do not have to specify the input and output formats. The input file format is auto detected and the output format is guessed from the specified file extension.
Convert a video file from mov to mp4:
ffmpeg -i input.mov output.mp4
Convert an audio file from mp3 to flac:
ffmpeg -i input.mp3 output.flac
To specify the codecs use the
-c option. The codec can be the name of any supported decoder/encoder or a special value
copy which simply copies the input stream.
Convert a video file from mp4 to webm using the
libvpxvideo codec and
ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm
Convert an audio file from mp3 to ogg encoded with the
ffmpeg -i input.mp3 -c:a libopus output.ogg
You have learned how to install FFmpeg on Debian 9. You can now visit the official FFmpeg Documentation page and learn how to use FFmpeg to convert and your video and audio files.
If you hit a problem or have feedback, leave a comment below.