Skip to content
systemcoding.dev
Media

Install FFmpeg and Check Which Encoders Your Build Supports

Install FFmpeg on Linux, macOS or Windows, then read its build banner and list its encoders so you know which codecs your copy can really write.

6 min read
Summarize in AI
Flat illustration of video frames passing through a codec, with the FFmpeg, GStreamer and VLC media player logos.

Two machines can both answer ffmpeg -version and still behave differently. One encodes H.264 with libx264, the other fails with "Unknown encoder 'libx264'". The difference is not the version number. It is the build: FFmpeg is compiled with a list of optional libraries, and a package that left one out cannot use it. This post installs FFmpeg 7.1 the common ways, then teaches you to read the build banner and the encoder list, so you know what your copy can do before you write a long command.

Install FFmpeg

Use your system package manager first. The packages are built with the common codecs enabled, and they get security updates.

On Debian and Ubuntu:

Shell
sudo apt update
sudo apt install ffmpeg

On Fedora, FFmpeg's full build lives in the RPM Fusion repository, because some codecs carry patent licensing concerns that the main repository avoids. Fedora's own ffmpeg-free package is a cut-down build. On Arch Linux, sudo pacman -S ffmpeg gives a full build.

On macOS with Homebrew:

Shell
brew install ffmpeg

On Windows, the official FFmpeg site links to builds from third parties rather than hosting binaries itself, and winget install ffmpeg installs one of them. After installing, open a new terminal so the PATH change takes effect.

Building from source is a different job, covered by the custom build post at the end of this cluster. For everyday work, a package is the right answer. The FFmpeg download page is the primary source for which builds exist.

Check that it runs

Shell
ffmpeg -version
Text
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 14 (Debian 14.2.0-12)
configuration: --prefix=/usr --enable-gpl --enable-libx264 --enable-libx265 --enable-libvpx --enable-libopus --enable-libmp3lame --enable-libsvtav1 --enable-libass --enable-shared
libavutil      59. 39.100 / 59. 39.100
libavcodec     61. 19.100 / 61. 19.100
libavformat    61.  7.100 / 61.  7.100
libavfilter    10.  4.100 / 10.  4.100
libswscale      8.  3.100 /  8.  3.100
libswresample   5.  3.100 /  5.  3.100

Your lines will differ in the version, compiler and the configuration list. The file you care about is the third block, configuration:. Every --enable-libsomething flag is a codec or feature compiled in. That one line tells you more than the version.

Three flags matter most for beginners:

Flag in configuration:What it gives you
--enable-libx264The libx264 H.264 encoder
--enable-libx265The libx265 HEVC encoder
--enable-gplAllows GPL-licensed parts such as x264 and x265; a build without it cannot include them

If --enable-libx264 is missing, no -c:v libx264 command will ever work on that machine. That is the cause of the "Unknown encoder" error, and it is fixed by installing a different build, not by changing your command.

List the encoders

The -encoders option prints every encoder compiled in. The list is long, so filter it:

Shell
ffmpeg -hide_banner -encoders | grep -i -E "x264|x265|aac|opus|libvpx|svtav1"
Text
 V....D libsvtav1            SVT-AV1(Scalable Video Technology for AV1) encoder (codec av1)
 V....D libvpx               libvpx VP8 (codec vp8)
 V....D libvpx-vp9           libvpx VP9 (codec vp9)
 V....D libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V....D libx265              libx265 H.265 / HEVC (codec hevc)
 A....D aac                  AAC (Advanced Audio Coding)
 A....D libopus              libopus Opus (codec opus)

Read the first column as flags. The first letter is the type: V for video, A for audio, S for subtitles. The letters after it show capabilities such as threading and whether the encoder is experimental. The second column is the name you pass to -c:v or -c:a. Use that name, not the codec family. h264 is the codec; libx264 is one encoder for it.

The -hide_banner option removes the version and configuration block that FFmpeg prints at the start of every run, which makes output shorter. We add it to every listing command.

To see everything one encoder accepts, ask for its help:

Shell
ffmpeg -hide_banner -h encoder=libx264
Text
Encoder libx264 [libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
    General capabilities: dr1 delay threads 
    Threading capabilities: auto
    Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 yuv420p10le yuv422p10le yuv444p10le nv20le gray gray10le
libx264 AVOptions:
  -preset            <string>     E..V....... Set the encoding preset (default "medium")
  -tune              <string>     E..V....... Tune the encoding params (default "")
  -crf               <float>      E..V....... Select the quality for constant quality mode (from -1 to FLT_MAX) (default -1)

This block is excerpted; a real run prints many more options. It is the fastest way to confirm that an option such as -crf exists for the encoder you chose, and to see the default value.

Check decoders, containers and filters

The same pattern works for the other stages of the pipeline:

QuestionCommand
Which decoders can I read?ffmpeg -hide_banner -decoders
Which containers can I write?ffmpeg -hide_banner -formats
Which filters exist?ffmpeg -hide_banner -filters
What pixel formats exist?ffmpeg -hide_banner -pix_fmts

The -formats output marks each container D (demuxing, can read) or E (muxing, can write). A container with only D can be read but not written by your build. For example, you might find you can read a format but not write it, which would explain a muxer error on output.

A short check that your build can write the two most common web formats:

Shell
ffmpeg -hide_banner -formats | grep -E " mp4 | webm "
Text
 DE mp4             MP4 (MPEG-4 Part 14)
 DE webm            WebM

Both lines start with DE, so your copy can read and write each of them.

What to do when an encoder is missing

There are three honest answers, in order of effort:

  1. Install a fuller package. On Fedora that means enabling RPM Fusion; on Windows it means choosing a "full" build from the linked builders.

  2. Pick a different encoder you do have. If libx264 is missing but libopenh264 is present, you can encode H.264 with it, with fewer tuning options. FFmpeg also has native encoders such as aac and mpeg4 that need no external library.

  3. Build FFmpeg yourself with the flags you need. That is the expert option, and it is slower than the first two.

Do not try to work around a missing encoder by changing the output extension. The extension picks the container, not the codec, so out.mp4 does not make FFmpeg find libx264.

A habit that saves time

Paste the output of ffmpeg -version into your notes the first time you set up a machine. When a script that worked on your laptop fails on a server, comparing the two configuration: lines finds the cause in one minute. We have lost an afternoon to a CI image whose FFmpeg lacked --enable-libx265, and the failing job only said "Unknown encoder" after twenty minutes of queued work. A one-line check at the top of the script, ffmpeg -hide_banner -encoders | grep -q libx265, would have failed it in a second.

Reading the library versions

The last six lines of the version banner list the libav libraries FFmpeg links against: libavutil, libavcodec, libavformat, libavfilter, libswscale and libswresample. Each prints two version triples, the one the program was built with and the one it found at run time. When the two differ, the program is running against a different shared library than it was compiled for, which happens after a partial upgrade or when a second FFmpeg install sits earlier on your PATH. Run which -a ffmpeg on Linux and macOS, or where ffmpeg on Windows, to see every copy the shell can find. Two copies on one machine are a more common source of "it worked yesterday" than any bug in FFmpeg itself.

The banner also names the compiler and the platform build. You rarely need those, but they help when you report a problem, because the FFmpeg bug tracker asks for the full output of the failing command, including this block.

Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.