Portainer Templates logo

Portainer Templates

Ffmpeg Ffmpeg

Media Tools

This container needs special attention. Please check https://hub.docker.com/r/linuxserver/ffmpeg for details.

Image details

Pulls: 5.4M
Architectures: amd64, arm64
Image size: 240 MB
Latest: 8.1.2
User: linuxserver
Created: Sep 23, 2019
Updated: 10 days ago
Status: active

Configuration

Type
Container
Platform
linux
Image
linuxserver/ffmpeg:latest
Ports
80:80/tcp
Volumes
/config : /srv/lsio/ffmpeg/config
Env vars
PUID=1000PGID=1000TZ=Etc/UTC
Restart
unless-stopped

Template by technorabilia

Notes

Portainer App Templates by Technorabilia, based on data provided by LinuxServer.io.

Ensure to create the following volume directories on the host file system, or modify the paths in the volume mapping section under the advanced options below, as needed.

mkdir -p /srv/lsio/ffmpeg/config

Installation

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select the app you wish to deploy, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo

docker run -d --name Ffmpeg \
  -p 80:80/tcp \
  -e 'PUID=1000' \
  -e 'PGID=1000' \
  -e 'TZ=Etc/UTC' \
  -v /srv/lsio/ffmpeg/config:/config \
  --restart=unless-stopped \
  linuxserver/ffmpeg:latest

Save this file as compose.yaml and run docker compose up -d
Use this only as a guide.

services:
  ffmpeg:
    image: linuxserver/ffmpeg:latest
    ports:
      - 80:80/tcp
    volumes:
      - /srv/lsio/ffmpeg/config:/config
    environment:
      PUID: '1000'
      PGID: '1000'
      TZ: Etc/UTC
    restart: unless-stopped

Save this file as ffmpeg-stack.yml, then from a manager node, run docker stack deploy -c ffmpeg-stack.yml ffmpeg

version: '3.8'
services:
  ffmpeg:
    image: linuxserver/ffmpeg:latest
    ports:
      - 80:80/tcp
    volumes:
      - /srv/lsio/ffmpeg/config:/config
    environment:
      PUID: '1000'
      PGID: '1000'
      TZ: Etc/UTC
    deploy:
      restart_policy:
        condition: any

Save each file below into a folder, then run kubectl apply -f .
Written for k3s, but works on any cluster: bind mounts use hostPath, named volumes get a persistent volume claim, and ports are exposed via a LoadBalancer service.

ffmpeg-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ffmpeg
  labels:
    app: ffmpeg
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ffmpeg
  template:
    metadata:
      labels:
        app: ffmpeg
    spec:
      containers:
        - name: ffmpeg
          image: linuxserver/ffmpeg:latest
          env:
            - name: PUID
              value: '1000'
            - name: PGID
              value: '1000'
            - name: TZ
              value: Etc/UTC
          ports:
            - containerPort: 80
              protocol: TCP
          volumeMounts:
            - name: ffmpeg-data-0
              mountPath: /config
      volumes:
        - name: ffmpeg-data-0
          hostPath:
            path: /srv/lsio/ffmpeg/config

ffmpeg-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: ffmpeg
spec:
  type: LoadBalancer
  selector:
    app: ffmpeg
  ports:
    - name: 80-tcp
      port: 80
      targetPort: 80
      protocol: TCP

Save this file as ~/.config/containers/systemd/ffmpeg.container

[Unit]
Description=Ffmpeg

[Container]
Image=linuxserver/ffmpeg:latest
ContainerName=ffmpeg
PublishPort=80:80/tcp
Environment=PUID=1000
Environment=PGID=1000
Environment=TZ=Etc/UTC
Volume=/srv/lsio/ffmpeg/config:/config

[Service]
Restart=always

[Install]
WantedBy=default.target

Then reload systemd and start the service:

systemctl --user daemon-reload
systemctl --user start ffmpeg

For a system-wide service, use /etc/containers/systemd/ and drop --user.

For more installation options, see the Documentation in our GitHub repo

linuxserver.io
Blog Discord Discourse Fleet GitHub Open Collective
The LinuxServer.io team brings you another container release featuring:
  • regular and timely application updates
  • easy user mappings (PGID, PUID)
  • custom base image with s6 overlay
  • weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth
  • regular security updates

Find us at:
  • Blog - all the things you can do with our containers including How-To guides, opinions and much more!
  • Discord - realtime support / chat with the community and the team.
  • Discourse - post on our community forum.
  • Fleet - an online web interface which displays all of our maintained images.
  • GitHub - view the source for all of our repositories.
  • Open Collective - please consider helping us by either donating or contributing to our budget

linuxserver/ffmpeg

Scarf.io pulls GitHub Stars GitHub Release GitHub Package Repository GitLab Container Registry Quay.io Docker Pulls Docker Stars Jenkins Build
FFmpeg - A complete, cross-platform solution to record, convert and stream audio and video.
ffmpeg

Supported Architectures

We utilise the docker manifest for multi-platform awareness. More information is available from docker here and our announcement here.
Simply pulling lscr.io/linuxserver/ffmpeg:latest should retrieve the correct image for your arch, but you can also pull specific arch images via tags.
The architectures supported by this image are:
| Architecture | Available | Tag | | :----: | :----: | ---- | | x86-64 | ✅ | amd64-\ | | arm64 | ✅ | arm64v8-\ | | armhf | ❌ | |

Usage

Unlike most of our container library this image is meant to be run ephemerally from the command line parsing user input for a custom FFmpeg command. You will need to understand some Docker basics to use this image and be familiar with how to construct an FFmpeg command. In the commands below we will be bind mounting our current working directory from the CLI to /config, the assumption is that input.mkv is in your current working directory.
If an input file is detected we will run FFmpeg as that user/group so the output file will match its permissions. The image supports Hardware acceleration on x86 pay close attention to the variables for the examples below.

Included Intel Drivers (latest versions compiled):

  • iHD Driver: Supports gen8+ (default for Intel)
  • i965 Driver: Supports gen5+ (for gen5-gen9.5 it can be enabled by setting env var LIBVA_DRIVER_NAME=i965 in docker arguments)
  • Libva (VAAPI): Supports gen5+ with i965 driver and gen8+ with iHD driver
  • Qsv Dispatcher: OneVPL (supports both OneVPL and MSDK runtimes and should automatically switch)
  • Qsv Runtime:
* OneVPL: Supports gen12+
* MSDK (libmfx): Supports gen8 - gen12

Basic Transcode

docker run --rm -it \
  -v $(pwd):/config \
  linuxserver/ffmpeg \
  -i /config/input.mkv \
  -c:v libx264 \
  -b:v 4M \
  -vf scale=1280:720 \
  -c:a copy \
  /config/output.mkv

Hardware accelerated (VAAPI) (click for more info)

docker run --rm -it \
  --device=/dev/dri:/dev/dri \
  -v $(pwd):/config \
  linuxserver/ffmpeg \
  -vaapi_device /dev/dri/renderD128 \
  -i /config/input.mkv \
  -c:v h264_vaapi \
  -b:v 4M \
  -vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \
  -c:a copy \
  /config/output.mkv

Hardware accelerated (QSV) (click for more info)

docker run --rm -it \
  --device=/dev/dri:/dev/dri \
  -v $(pwd):/config \
  linuxserver/ffmpeg \
  -hwaccel qsv \
  -c:v h264_qsv \
  -i /config/input.mkv \
  -c:v h264_qsv \
  -global_quality 25 \
  /config/output.mkv

Nvidia Hardware accelerated (click for more info)

Nvidia support requires Nvidia container toolkit and the Nvidia drivers installed on the host.
docker run --rm -it \
  --runtime=nvidia \
  -v $(pwd):/config \
  linuxserver/ffmpeg \
  -hwaccel nvdec \
  -i /config/input.mkv \
  -c:v h264_nvenc \
  -b:v 4M \
  -vf scale=1280:720 \
  -c:a copy \
  /config/output.mkv

Vulkan support

Vulkan support has been added to x8664 (tested with Intel and AMD iGPU) (click for more info).
docker run --rm -it \
  --device=/dev/dri:/dev/dri \
  -v $(pwd):/config \
  -e ANV_VIDEO_DECODE=1 \
  linuxserver/ffmpeg \
  -init_hw_device "vulkan=vk:0" \
  -hwaccel vulkan \
  -hwaccel_output_format vulkan \
  -i /config/input.mkv \
  -f null - -benchmark

Vulkan supports three drivers

  • ANV: To enable for Intel, set the env var ANV_VIDEO_DECODE=1
  • RADV: To enable on AMD, set the env var RADV_PERFTEST=video_decode
  • NVIDIA: To enable on Nvidia, install Nvidia Vulkan Beta drivers on the host per this article

Building locally

If you want to make local modifications to these images for development purposes or just to customize the logic:
git clone https://github.com/linuxserver/docker-ffmpeg.git
cd docker-ffmpeg
docker build \
  --no-cache \
  --pull \
  -t lscr.io/linuxserver/docker-ffmpeg:latest .

The ARM variants can be built on x8664 hardware using multiarch/qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static:register --reset

Once registered you can define the dockerfile to use with -f Dockerfile.aarch64.

Versions

  • 25.06.26: - Bump ffmpeg to 8.1.2. Also bump aom, harfbuzz, libass, libdrm, libvmaf, mesa, rist and vulkan sdk.
  • 02.05.26: - Bump ffmpeg to 8.1. Also bump aom, freetype, harfbuzz, Intel drivers and libs, libdovi, libdrm, libplacebo, libpng, mesa, rist, shaderc, srt, svtav1 and x265.
  • 06.03.26: - Add support for SoX Resampler. Bump freetype, harfbuzz, Intel drivers and libs, libplacebo, libpng, mesa, shaderc, svtav1, vpx, vulkan-sdk and vvenc.
  • 06.01.26: - Remove mpp from aarch64 build due to upstream DMCA removal. Bump harfbuzz, libdav1d, libdrm, libpng, libva, libvpl, mesa, opus, shaderc and vulkan-sdk.
  • 01.12.25: - Bump ffmpeg to 8.0.1.
  • 19.11.25: - Bump aom, freetype, harfbuzz, Intel drivers and libs, kvazaar, libdav1d, libdrm, mesa, mpp, openjpeg, shaderc, svt-av1 and vulkan-sdk.
  • 23.08.25: - Bump ffmpeg to 8.0. Bump harfbuzz, Intel drivers and libs, libdovi, libdrm, libpng, mesa, ogg, rav1e, shaderc, svt-av1, vulkan-sdk, webp and zimg.
  • 06.08.25: - Bump svt-av1.
  • 07.06.25: - Bump harfbuzz, libass, libdovi, libplacebo, libpng, mesa, rav1e, shaderc, libvpx and vulkan-sdk.
  • 04.06.25: - Add libdrm and rkmpp to arm64 image.
  • 21.04.25: - Bump aom, Intel drivers and libs, harfbuzz, mesa, svt-av1, libvpx, libtheora, vulkan-sdk and vvenc.
  • 07.03.25: - Bump ffmpeg to 7.1.1, Bump aom, fontconfig, Intel drivers and libs, harfbuzz, libdav1d, libdovi, libdrm, liblc3, libpng, mesa, openjpeg, shaderc, svt-av1, vulkan-sdk, vvenc and webp.
  • 26.11.24: - Bump libaom, mesa, rist, srt and libx265.
  • 07.11.24: - Bump harfbuzz, Intel drivers and libs, libdav1d, mesa, svtav1, vpx, vulkan sdk and vvenc.
  • 05.10.24: - Add support for libvvenc on aarch64. Bump mesa.
  • 30.09.24: - Bump ffmpeg for 7.1. Add support for libvvenc (amd64 only) and liblc3. Bump libfribidi and libharfbuzz.
  • 24.09.24: - Let ffmpeg terminate gracefully on docker stop/restart. Bump libharfbuzz, libpng, mesa, shaderc and libx265.
  • 09.09.24: - Add libzmq.
  • 31.08.24: - Bump libaom, libdrm, libvpl, mesa and svtav1. Enable nvdec/nvenc on arm64 (untested).
  • 17.08.24: - Bump ffmpeg, freetype, libdovi and mesa.
  • 14.08.24: - Add SRT and libRIST.
  • 01.08.24: - Add libdav1d. Bump libharfbuzz, various Intel drivers and libs, libass, libdrm, libplacebo, libva, mesa, svtav1, and vulkan sdk.
  • 21.06.24: - Bump mesa and libaom. Update lib path for rav1e.
  • 08.06.24: - Bump ffmpeg, fribidi, libdrm, mesa and vpx.
  • 26.05.24: - Rebase to Ubuntu Noble. Bump libass, libharfbuzz and vulkan-sdk.
  • 22.05.24: - Bump Mesa to 24.1.0.
  • 20.05.24: - Bump libsvtav1.
  • 09.05.24: - Bump libaom, fribidi, kvazaar, various Intel drivers and libs, Mesa, opus, shaderc, webp and x265.
  • 11.04.24: - Explicitly disable libdrm on aarch64, add new lib libxcb-shm0. Add quick test at the end of build.
  • 10.04.24: - Compile ffmpeg with libfribidi, libharfbuzz and libfontconfig, compile libharfbuzz.
  • 05.04.24: - Bump ffmpeg to 7.0, bump libdovi, libva, mesa and vulkan-sdk.
  • 16.03.24: - Bump libaom, mesa, openjpeg, opus, shaderc and svtav1.
  • 11.02.24: - Add Zimg support.
  • 09.02.24: - Bump ffmpeg to 6.1.1, bump other deps.
  • 08.02.24: - Enable cuda-llvm, clean up rustc.
  • 01.02.24: - Bump Mesa to v24.
  • 21.01.24: - Add alsa support.
  • 18.01.24: - Let the wrapper pass the ffmpeg exit code to docker run. Bump various libs.
  • 01.01.24: - Add rav1e support. Bump libaom, fdkaac, libdrm, libvmaf, libvpl, mesa and svt-av1.
  • 06.12.23: - Add libplacebo and libdobi to x8664.
  • 05.12.23: - Bump Mesa. Fix vdpau. Fix AMD VAAPI.
  • 25.11.23: - Compile Mesa from source. Add proper Vulkan support (env var ENABLE_VULKAN=true no longer needed)(tested with Intel).
  • 22.11.23: - Add shaderc and (preliminary) Vulkan support (via env var ENABLE_VULKAN=true) to x8664. Bump Intel drivers and other libs.
  • 13.11.23: - Bump FFmpeg to 6.1.
  • 02.11.23: - Remove --enable-small from ffmpeg build options to add back some features.
  • 05.10.23: - Add support for SVT-AV1. Update various libraries.
  • 16.08.23: - Added support for WebP formats.
  • 11.08.23: - Add optional i965 driver for gen5+ support.
  • 14.06.23: - Switch to latest iHD for Intel, add qsv support.
  • 13.06.23: - Bump to 6.0, update shared libraries, deprecate armhf, combine bin stage.
  • 14.12.22: - Rebase to Jammy, bump to 5.1.2.
  • 19.06.22: - Rebase to Focal.
  • 26.08.21: - Add support for libOpenCL.
  • 01.07.21: - Bump to 4.4.
  • 17.06.20: - Bump to 4.3.
  • 16.06.20: - Add support for libvmaf.
  • 01.08.19: - Initial release.

Serve Ffmpeg on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.

Proxying ffmpeg.example.com to http://Ffmpeg:80

Add this to your Caddyfile

ffmpeg.example.com {
	reverse_proxy http://Ffmpeg:80
}

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs Ffmpeg
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Port already in use

If deployment fails with "Bind for 0.0.0.0:80 failed: port is already allocated", something else on your server is using that port.

  • Find what's using it: sudo ss -tlnp | grep :80
  • Stop the other service, or pick a different host port. In 80:80 only the left number is yours to change, the right one belongs to the app.

Running but the page won't load

The container is up but nothing appears in your browser.

  • Use your server's real IP: http://your-server-ip:80. The 0.0.0.0 link Portainer shows isn't a real address.
  • Give it a minute after first deploy, Ffmpeg can take a while to initialise.
  • Make sure your firewall allows the port, e.g. sudo ufw allow 80

Permission denied on volumes

If the logs show "permission denied", the app can't write to its data folder on the host.

  • Fix the ownership: sudo chown -R 1000:1000 /srv/lsio/ffmpeg/config
  • Or set the PUID and PGID variables (defaults 1000:1000) to match your own user, found with id $USER

Image won't pull

Test the pull directly on the host: docker pull linuxserver/ffmpeg:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64, arm64
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect Ffmpeg --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

Similar apps