Operating System Debian

How to Install FFmpeg on Debian 13 (and Debian 12)

Install FFmpeg 7.1 on Debian 13 (or 5.1 on Debian 12) with one apt command, check the available encoders and run a few common conversions.

FFmpeg is the standard command-line toolkit for converting, cutting, streaming and inspecting audio and video. On Debian 13 "trixie" it is a single package in the main archive, so installing it takes one command and no extra repositories. This guide installs FFmpeg on Debian 13, notes what differs on Debian 12 "bookworm", and shows a few commands to confirm the installation works.

Debian 8 and Debian 9 are both end-of-life and receive no security updates. Third-party multimedia repositories that older tutorials added on those releases are not needed on a supported Debian release.

Requirements

  • A server running Debian 13 (or Debian 12).
  • A user with sudo rights; the examples use deploy.
  • A few hundred megabytes of free disk space: the package pulls in a large set of codec libraries.

Which version you get

ReleaseFFmpeg series in the archive
Debian 13 "trixie"7.1
Debian 12 "bookworm"5.1

Both are maintained by Debian for the lifetime of the release: security fixes arrive as updates within the same series through the normal apt upgrade process. The commands in this guide are identical on both releases.

Step 1: Install FFmpeg

Refresh the package index:

sudo apt update

Install the package:

sudo apt install -y ffmpeg

The ffmpeg package provides four programs: ffmpeg (the converter), ffprobe (shows information about media files), ffplay (a simple player, of little use on a server without a display) and qt-faststart (rearranges MP4 files so they start playing before the download finishes). The shared libraries such as libavcodec and libavformat are installed automatically as dependencies.

If you want the manual in HTML form on the server as well, install the optional documentation package:

sudo apt install -y ffmpeg-doc

Step 2: Confirm the installation

Print the version and build configuration:

ffmpeg -version

The first line shows the version (7.1.x on Debian 13), followed by the configure flags Debian built it with and the versions of the bundled libraries.

Check that the encoders you plan to use are present. This example looks for the common H.264, H.265, VP9, AV1 and Opus encoders:

ffmpeg -hide_banner -encoders | grep -E 'libx264|libx265|libvpx|libsvtav1|libopus'

To list everything the build supports, use ffmpeg -formats, ffmpeg -codecs, ffmpeg -encoders and ffmpeg -decoders.

Step 3: Try a few common commands

Inspect a file without converting it:

ffprobe -hide_banner input.mp4

Convert a video to H.264 video and AAC audio in an MP4 container. -crf sets the quality (lower is better and larger; 23 is the x264 default) and -preset trades encoding speed for file size:

ffmpeg -i input.mov -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4

Change the container without re-encoding, which is fast and lossless:

ffmpeg -i input.mkv -c copy output.mp4

Extract the audio track as MP3:

ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 2 output.mp3

Cut a 30-second clip starting at one minute, again without re-encoding:

ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c copy clip.mp4

Scale a video to 1280 pixels wide while keeping the aspect ratio (-2 picks an even height automatically):

ffmpeg -i input.mp4 -vf scale=1280:-2 -c:a copy output-720p.mp4

Video encoding is CPU-intensive. On a small VPS a long encode can occupy every core for the duration; limit it with -threads 2 or run it under nice if the server also handles other work:

nice -n 19 ffmpeg -i input.mov -c:v libx264 -crf 23 -threads 2 -c:a aac output.mp4

Keeping FFmpeg updated

FFmpeg parses untrusted media files, so security updates matter, especially if your server processes uploads from users. They arrive with regular system updates:

sudo apt update
sudo apt upgrade

Check which version is installed and which is available at any time:

apt policy ffmpeg

To remove FFmpeg and the libraries that were installed only for it:

sudo apt remove ffmpeg
sudo apt autoremove

Frequently asked questions

How do I get a newer FFmpeg than the one Debian ships?

Debian keeps one FFmpeg series for the whole life of a release, so a newer major version only arrives with the next Debian release. If you need a specific newer feature, the FFmpeg download page links to static Linux builds maintained by third parties, and you can also compile from the official source; both leave you responsible for security updates. Avoid mixing packages from Debian testing or third-party repositories into a stable system, because the FFmpeg libraries are shared with many other packages.

Is the Fraunhofer FDK AAC encoder (libfdk_aac) included?

No. Its licence is incompatible with the GPL-licensed build Debian distributes, so the packaged FFmpeg is built without it. FFmpeg's built-in aac encoder, used in the examples above, is always available.

Can FFmpeg use a GPU on a VPS?

Only if the server actually has a GPU passed through and the matching drivers installed. Ordinary virtual servers have none, so encoding runs on the CPU. You can list the acceleration methods the build knows about with ffmpeg -hwaccels; a method appearing in that list does not mean the hardware is present.

Does the same command work on Ubuntu?

Yes. Ubuntu also ships FFmpeg as the ffmpeg package (in the universe component), so sudo apt install ffmpeg works there too; only the version differs by release.

Share story:

Continue reading other guides on How VPS.