ffmpeglinuxdevops

How to Install FFmpeg on Ubuntu: apt, PPA, Snap, or Static

·Javid Jamae·10 min read
How to Install FFmpeg on Ubuntu: apt, PPA, Snap, or Static

You need FFmpeg on a fresh Ubuntu box, and the top three search results tell you to add a PPA before you've even checked what apt already has. That's backwards, and on a server it's the start of a version-drift problem you'll be untangling six months from now.

Quick answer: To install FFmpeg Ubuntu ships in the Universe repository, run sudo apt update && sudo apt install ffmpeg, then confirm with ffmpeg -version. You don't need a PPA for this: Ubuntu 22.04 LTS carries FFmpeg 4.4.2 and Ubuntu 24.04 LTS carries FFmpeg 6.1.1. Reach for a PPA, the Snap, or a static build only when you need a version newer than your release ships.

Install FFmpeg on Ubuntu with apt

Conventional wisdom says Ubuntu's packaged FFmpeg is too old to bother with, so you add a PPA first. That's partly true: the archive freezes at whatever FFmpeg was current when the release was cut, so a 24.04 box is running a 2023 build. But the version number isn't what bites you on a server. The churn is. Every non-apt install method trades away either update automation or reproducibility, and you don't find out which until a filter graph behaves differently on box 7 of 12.

Look before you leap:

apt policy ffmpeg

On Ubuntu 24.04 LTS you'll see something like this:

ffmpeg:
  Installed: (none)
  Candidate: 7:6.1.1-3ubuntu5
  Version table:
     7:6.1.1-3ubuntu5 500
        500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages

The 7: prefix is the Debian epoch, not a version. The real version is 6.1.1. If that covers what you need, install it:

sudo apt update
sudo apt install ffmpeg
ffmpeg -version

If apt says the package doesn't exist

E: Unable to locate package ffmpeg almost always means the Universe component isn't enabled, which happens on minimal cloud and container images. Enable it:

sudo add-apt-repository universe
sudo apt update
sudo apt install ffmpeg

Check what's actually compiled in

The version number matters less than the build config. Ubuntu's package is built with libx264, libx265, libvpx, libopus, and VA-API, and without the non-free libfdk_aac encoder. Verify on the box:

ffmpeg -encoders | grep -E 'libx264|libx265|nvenc'
ffmpeg -hwaccels
ffmpeg -buildconf

ffmpeg -buildconf prints every ./configure flag the package was built with. Capture that in your provisioning logs. It's the fastest way to explain why the same command produces different output on two machines.

Which FFmpeg version ships with which Ubuntu release

Ubuntu releaseCodenameFFmpeg in Universe
20.04 LTSFocal Fossa4.2.x
22.04 LTSJammy Jellyfish4.4.2
24.04 LTSNoble Numbat6.1.1

Newer LTS and interim releases follow the same rule, so don't trust any table. Run apt policy ffmpeg on the actual host.

When you genuinely need a newer FFmpeg

The honest test: name the feature. If you can't, apt wins. Real reasons to go newer, with the version that introduced them:

  • -fps_mode replacing the deprecated -vsync (FFmpeg 5.1)
  • AV1 encoding via av1_nvenc on Ada-generation NVIDIA GPUs (FFmpeg 6.0)
  • The native VVC/H.266 decoder enabled by default (FFmpeg 7.1)
  • The whisper audio transcription filter for caption generation (FFmpeg 8.0)

If your job is transcoding H.264, resizing for social, burning in subtitles, or extracting audio, FFmpeg 4.4 on Ubuntu 22.04 does all of it. Adding a PPA to get 8.1 for a -c:v libx264 -crf 23 pipeline is pure risk with no payoff.

Option 1: a PPA

PPAs give you a newer FFmpeg that still updates through apt upgrade. The two archives people actually use are savoury1 (which has maintained ffmpeg4 through ffmpeg7 archives) and ubuntuhandbook1 (currently publishing FFmpeg 8.1). The pattern:

sudo add-apt-repository ppa:ubuntuhandbook1/ffmpeg8
sudo apt update
sudo apt install ffmpeg

The cost is real and underreported. A newer FFmpeg needs newer libx264, libx265, libvpx, libaom, and a dozen other shared libraries, so the PPA replaces those system-wide. Anything else on the box linked against them comes along for the ride. That's fine on a dedicated encoding node and genuinely bad on a box that also runs your application server.

Install ppa-purge before you install the PPA, not after you've broken something:

sudo apt install ppa-purge
sudo ppa-purge ppa:ubuntuhandbook1/ffmpeg8

The other cost is that a PPA is one person's hobby. When the maintainer stops publishing, you're running an unsupported build with no security updates and no notification that it happened.

Option 2: Snap

sudo snap install ffmpeg

The Snap auto-updates on its own schedule, which is the selling point and also the disqualifier. Your CI runner's FFmpeg version can change between two builds with nothing in your commit history to explain it. Hold it if you use it:

sudo snap refresh --hold ffmpeg
sudo snap revert ffmpeg   # roll back to the previous revision

Strict confinement is the pitfall that costs people an afternoon. The Snap gets a private /tmp and can't read outside your home directory, so ffmpeg -i /tmp/input.mp4 fails with a permission error even though the file is clearly there. For /mnt and /media:

sudo snap connect ffmpeg:removable-media

And snapd doesn't run inside Docker containers, so the Snap is a non-starter for any containerized pipeline.

Option 3: a static build

Static builds bypass the package manager entirely. Two sources are worth trusting: John Van Sickle's builds at johnvansickle.com/ffmpeg (amd64, i686, arm64, armhf, with release and git-master branches) and the BtbN/FFmpeg-Builds project on GitHub, which publishes both GPL and LGPL variants and tends to be more current.

curl -L -O https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
curl -L -O https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz.md5
md5sum -c ffmpeg-release-amd64-static.tar.xz.md5
tar xf ffmpeg-release-amd64-static.tar.xz
sudo install -m755 ffmpeg-*-amd64-static/ffmpeg /usr/local/bin/ffmpeg
sudo install -m755 ffmpeg-*-amd64-static/ffprobe /usr/local/bin/ffprobe

The amd64 static tarball is roughly 30 MB compressed and the extracted ffmpeg binary is around 80 MB. Compare that to apt-get install -y ffmpeg on a bare ubuntu:24.04 image, which pulls in a couple hundred dependency packages. Check the exact count on your base:

apt-get install -s ffmpeg | tail -1

The static build's real cost is that you now own the CVE watch. FFmpeg's demuxers and decoders get security fixes regularly, and unattended-upgrades will never touch a binary in /usr/local/bin. Pin the URL, checksum it, and put a calendar reminder on it, or don't use this method.

apt vs PPA vs Snap vs static build

MethodVersionSecurity updatesReproducibleWorks in Docker/CIRollback
apt (Universe)Frozen at releaseYes, via Ubuntu securityHighYes`apt install ffmpeg=<version>`
PPALatest, if maintainedOnly if maintainer ships themMediumYes`ppa-purge`
SnapLatest, auto-refreshedYes, silentlyLow unless heldNo`snap revert`
Static buildWhatever you downloadedNone, you own itHighest, if checksummedYesSwap the binary

Pinning FFmpeg so your servers don't drift

Installing FFmpeg is a five-minute job. Keeping twelve boxes on the same FFmpeg is the actual work.

Hold the apt package so an unattended upgrade can't move it:

sudo apt-mark hold ffmpeg
apt-mark showhold

In a Dockerfile, pin the exact version and expect it to break:

RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg=7:6.1.1-3ubuntu5 \
 && rm -rf /var/lib/apt/lists/*

That build stops working the day Ubuntu publishes a security update for FFmpeg, because the archive drops the superseded version. The durable fixes are pinning your base image by digest (ubuntu@sha256:...) or pointing apt at snapshot.ubuntu.com for a frozen archive state. Pinning the package version alone gives you a reproducible build that reproduces for about six weeks.

If you're on a PPA, cap its priority so it only supplies FFmpeg and not the entire dependency chain, in /etc/apt/preferences.d/ffmpeg-ppa:

Package: *
Pin: release o=LP-PPA-ubuntuhandbook1-ffmpeg8
Pin-Priority: 100

Package: ffmpeg
Pin: release o=LP-PPA-ubuntuhandbook1-ffmpeg8
Pin-Priority: 600

Common pitfalls

  • ffmpeg: command not found after snap install. /snap/bin isn't on PATH in cron jobs and non-login shells. Use the absolute path /snap/bin/ffmpeg in crontabs and systemd units.
  • Two FFmpegs on one box. A PPA build lands in /usr/bin/ffmpeg and a static build in /usr/local/bin/ffmpeg, and /usr/local/bin usually wins on PATH. Run which -a ffmpeg when ffmpeg -version disagrees with apt policy ffmpeg.
  • Missing the AAC encoder you expected. Ubuntu builds without libfdk_aac for licensing reasons. The native aac encoder is fine at 128k and above for social delivery.
  • Testing on your laptop, deploying on the server. A 24.04 desktop and a 22.04 server are two FFmpeg major versions apart. Deprecated flags like -vsync still work on 4.4 and warn loudly on 6.1.
  • Skipping apt update. A stale package index is the most common cause of "package not found" on a container image that hasn't been refreshed since build.

When installing FFmpeg is the wrong move

If FFmpeg is a build-time tool on one CI box, install it with apt and stop reading.

Once FFmpeg is a runtime dependency of your product, every box you provision is another version to pin, another CVE feed to watch, and another node to scale when a customer uploads a 4 GB source file. A 20-minute transcode also means a 20-minute process you have to keep alive, retry, and clean up after. That's the argument our FFmpeg self-hosting total cost of ownership post makes with the actual numbers, and it's the same wall people hit running FFmpeg in GitHub Actions or inside an AWS Lambda layer.

FFmpeg Micro is the FFmpeg API: you submit a job, poll or take a webhook, download the output. No binaries, no versions, no servers to run. It works from code, from n8n, Make, and Zapier, and from AI agents through an MCP server. There's a free tier, and usage-based pricing after that, so the comparison against a $40/month encoding VM is one you can actually run. See the FFmpeg API overview and pricing.

FAQ

What's the command to install FFmpeg on Ubuntu?

sudo apt update && sudo apt install ffmpeg. It comes from the Universe repository, which is enabled by default on standard Ubuntu Desktop and Server installs. On minimal cloud images, run sudo add-apt-repository universe first.

Do I need a PPA to install FFmpeg on Ubuntu?

No. Ubuntu 22.04 LTS carries FFmpeg 4.4.2 and Ubuntu 24.04 LTS carries FFmpeg 6.1.1 in Universe, both of which handle H.264 and H.265 transcoding, subtitle burn-in, watermarking, and audio extraction. Use a PPA only when you can name the specific newer feature you need.

How do I check which FFmpeg version is installed?

Run ffmpeg -version for the version and build hash, ffmpeg -buildconf for the full list of compile flags, and apt policy ffmpeg to see what apt thinks is installed versus available. When the first two disagree with the third, you have a second FFmpeg on PATH.

Why can't the FFmpeg Snap read my file?

Strict confinement. The Snap gets a private /tmp and can only see files under your home directory by default. Move the input into $HOME, or run sudo snap connect ffmpeg:removable-media for paths under /mnt and /media.

How do I uninstall FFmpeg on Ubuntu?

sudo apt remove ffmpeg for the apt package, sudo snap remove ffmpeg for the Snap, and sudo rm /usr/local/bin/ffmpeg /usr/local/bin/ffprobe for a static build. If you added a PPA, run sudo ppa-purge ppa:<owner>/<name> instead of apt remove so the upgraded shared libraries get reverted too.

If you'd rather not carry an FFmpeg version on every box you provision, run the same jobs as one API call and skip the install entirely. Sign up free and try your current command in the playground before you write any code.

About Javid Jamae

Founder & CEO at FFmpeg Micro

Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.

Software EngineeringVideo ProcessingFFmpegCloud ArchitectureAPI DesignAutomation

Ready to process videos at scale?

Start using FFmpeg Micro's simple API today. No infrastructure required.

Get Started Free