Skip to content

Instantly share code, notes, and snippets.

@dansup
Last active June 25, 2026 13:48
Show Gist options
  • Select an option

  • Save dansup/460039bf77284752cbf5ca7d6406f6c4 to your computer and use it in GitHub Desktop.

Select an option

Save dansup/460039bf77284752cbf5ca7d6406f6c4 to your computer and use it in GitHub Desktop.
How to update ffmpeg to the latest version for Pixelfed and Loops on Ubuntu

Update FFmpeg to 8.1.2 on Ubuntu for Pixelfed / Loops

This guide installs FFmpeg 8.1.2 from source on Ubuntu (24.04 LTS) for servers that process user-uploaded media, such as Pixelfed or Loops.

This fixes the pixelsmash vulnerability.

It installs FFmpeg into:

/opt/ffmpeg/8.1.2

Then symlinks the active binaries to:

/usr/local/bin/ffmpeg
/usr/local/bin/ffprobe

This avoids replacing Ubuntu’s packaged /usr/bin/ffmpeg directly and makes rollback easier.

Why install from source?

Ubuntu 24.04 LTS may not ship the latest upstream FFmpeg release through apt.

For Pixelfed and Loops services, staying current matters because FFmpeg parses untrusted media files during transcoding, thumbnailing, probing, and metadata extraction.


0. Check your current FFmpeg version

which ffmpeg
ffmpeg -version

which ffprobe
ffprobe -version

You may see something like:

/usr/bin/ffmpeg
ffmpeg version 6.x

After this guide, you should see:

/usr/local/bin/ffmpeg
ffmpeg version 8.1.2

1. Install build dependencies

sudo apt update

sudo apt install -y \
  build-essential pkg-config yasm nasm git curl wget ca-certificates gnupg \
  autoconf automake libtool cmake meson ninja-build \
  zlib1g-dev liblzma-dev libbz2-dev \
  libx264-dev libx265-dev libvpx-dev libopus-dev \
  libaom-dev \
  libass-dev libfreetype6-dev libfontconfig1-dev \
  libwebp-dev libvorbis-dev libnuma-dev

This build includes support for common Pixelfed / Loops-style transcoding needs:

  • H.264 via libx264
  • H.265 via libx265
  • VP8/VP9 via libvpx
  • AV1 via libaom
  • Opus audio
  • WebP
  • subtitles / text rendering support
  • MP4 output

This intentionally does not require libsvtav1 or libdav1d, because those optional dependencies may not be available or correctly detected on every Ubuntu server.


2. Download FFmpeg 8.1.2

cd /usr/local/src

sudo wget https://ffmpeg.org/releases/ffmpeg-8.1.2.tar.xz
sudo tar -xf ffmpeg-8.1.2.tar.xz

cd ffmpeg-8.1.2

3. Configure FFmpeg

sudo ./configure \
  --prefix=/opt/ffmpeg/8.1.2 \
  --enable-gpl \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libvpx \
  --enable-libopus \
  --enable-libaom \
  --enable-libass \
  --enable-libfreetype \
  --enable-libfontconfig \
  --enable-libwebp \
  --enable-libvorbis \
  --enable-zlib \
  --enable-lzma \
  --enable-pthreads

Notes:

  • --enable-gpl is required for libx264 and libx265.
  • This is generally fine for internal server-side transcoding.
  • Do not redistribute the compiled binary unless you understand the GPL licensing implications.

4. Build and install

sudo make -j"$(nproc)"
sudo make install

5. Symlink FFmpeg into /usr/local/bin

sudo ln -sfn /opt/ffmpeg/8.1.2/bin/ffmpeg /usr/local/bin/ffmpeg
sudo ln -sfn /opt/ffmpeg/8.1.2/bin/ffprobe /usr/local/bin/ffprobe

hash -r

Verify:

which ffmpeg
ffmpeg -version

which ffprobe
ffprobe -version

Expected path:

/usr/local/bin/ffmpeg
/usr/local/bin/ffprobe

Expected version:

ffmpeg version 8.1.2

6. Confirm required codec support

Check H.264 encoding:

ffmpeg -hide_banner -encoders | grep libx264

Check MP4 output support:

ffmpeg -hide_banner -muxers | grep mp4

Check common decoders:

ffmpeg -hide_banner -decoders | grep -E "h264|hevc|vp8|vp9|av1|aac|opus"

7. Run a quick MP4 smoke test

ffmpeg -hide_banner \
  -f lavfi \
  -i testsrc2=size=1080x1920:rate=30 \
  -t 5 \
  -c:v libx264 \
  -preset veryfast \
  -crf 23 \
  -pix_fmt yuv420p \
  -movflags +faststart \
  -an \
  /tmp/ffmpeg-test.mp4

ffprobe -hide_banner /tmp/ffmpeg-test.mp4

If this succeeds, FFmpeg can generate a basic H.264 MP4 file.


8. Configure Pixelfed

Edit your Pixelfed .env file:

nano .env

Set:

FFMPEG_BINARIES=/usr/local/bin/ffmpeg
FFPROBE_BINARIES=/usr/local/bin/ffprobe

Then refresh Laravel config and restart workers:

php artisan config:cache
php artisan cache:clear
php artisan horizon:terminate

If you use Supervisor workers instead of Horizon, restart them too:

sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart all

If needed, restart PHP-FPM:

sudo systemctl restart php8.3-fpm

Adjust the PHP-FPM service name if your server uses a different PHP version.


9. Configure Loops

For Loops, set the same binary paths in .env:

FFMPEG_BINARIES=/usr/local/bin/ffmpeg
FFPROBE_BINARIES=/usr/local/bin/ffprobe

After editing .env, refresh config and restart workers:

php artisan config:cache
php artisan cache:clear
php artisan horizon:terminate

10. Troubleshooting

Error: SvtAv1Enc >= 0.9.0 not found using pkg-config

Remove this configure flag:

--enable-libsvtav1

SVT-AV1 is only needed if you intentionally want AV1 encoding through SVT-AV1.

For Pixelfed / Loops MP4 transcoding, it is not required.


Error: dav1d >= 1.0.0 not found using pkg-config

Remove this configure flag:

--enable-libdav1d

dav1d is an optional AV1 decoder.

For Pixelfed / Loops MP4 transcoding, it is not required.


Error: libx264 not found

Install the missing package:

sudo apt update
sudo apt install -y libx264-dev

Then rerun the ./configure command.


Error: ffmpeg: command not found

Check the symlink:

ls -lah /usr/local/bin/ffmpeg
ls -lah /opt/ffmpeg/8.1.2/bin/ffmpeg

Recreate it:

sudo ln -sfn /opt/ffmpeg/8.1.2/bin/ffmpeg /usr/local/bin/ffmpeg
sudo ln -sfn /opt/ffmpeg/8.1.2/bin/ffprobe /usr/local/bin/ffprobe

hash -r

11. Rollback

To temporarily go back to Ubuntu’s packaged FFmpeg:

sudo ln -sfn /usr/bin/ffmpeg /usr/local/bin/ffmpeg
sudo ln -sfn /usr/bin/ffprobe /usr/local/bin/ffprobe

hash -r

ffmpeg -version

Or remove the custom symlinks:

sudo rm /usr/local/bin/ffmpeg
sudo rm /usr/local/bin/ffprobe

hash -r

Then verify:

which ffmpeg
ffmpeg -version

Done ✅

Final verification:

which ffmpeg
ffmpeg -version

which ffprobe
ffprobe -version

ffmpeg -hide_banner -encoders | grep libx264
ffmpeg -hide_banner -muxers | grep mp4

You should now be running FFmpeg 8.1.2 from:

/usr/local/bin/ffmpeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment