Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Below is a table that provides examples for the nomenclature:
| ffmpeg-8.1-ubuntu2404 | 24.04 | 8.x | amd64, arm64 | [ubuntu](https://releases.ubuntu.com/) | external libraries are installed from os packages, and ffmpeg is built from source. See [Ubuntu Compilation Guide](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) for details on this. |
| ffmpeg-8.1-ubuntu2404-edge | 24.04 | 8.x | amd64, arm64 | [ubuntu](https://releases.ubuntu.com/) | libs and ffmpeg are built from source. See [Ubuntu Compilation Guide](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) for details on this. |
| ffmpeg-8.1-vaapi2404 | 24.04 | 8.x | amd64 | [ubuntu](https://releases.ubuntu.com/) | like: `ubuntu2404` but enables: [Video Acceleration API (VAAPI)](https://trac.ffmpeg.org/wiki/HWAccelIntro#VAAPI) in ffmpeg |
| ffmpeg-8.1-amf2404 | 24.04 | 8.x | amd64 | [ubuntu](https://releases.ubuntu.com/) | like: `ubuntu2404` but enables: [AMD Advanced Media Framework (AMF)](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/Build-FFmpeg-with-AMF-Support) in ffmpeg |
| ffmpeg-8.1-nvidia2404 | 24.04 | 8.x | amd64 | [ubuntu](https://releases.ubuntu.com/) | Built w/ [NVIDIA's hardware-accelerated encoding and decoding APIs](https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC) enabled |
| ffmpeg-8.1-alpine320 | 3.20 | 8.x | amd64, arm64 | [alpine](https://alpinelinux.org/releases/) | vendor libs, but ffmpeg is built from source |
| ffmpeg-8.1-scratch320 | 3.20 | 8.x | amd64, arm64 | [alpine](https://alpinelinux.org/releases/) | vendor libs, and ffmpeg are built from source. Also we make the distro as small as possible by not installing any packages in base and striping symbols of installed libs |
Expand All @@ -43,6 +44,7 @@ Note: The current versions of ffmpeg supported are anything newer than 3 years o
- ubuntu based images `ffmpeg:<version>-ubuntu` or `ffmpeg:<version>-ubuntu2404` (old versions with `ffmpeg:<version>-ubuntu2004` , `ffmpeg:<version>-ubuntu1804`)
- ubuntu based nvidia images `ffmpeg:<version>-nvidia` or `ffmpeg:<version>-nvidia2404` (old versions with `ffmpeg:<version>-nvidia2204`, `ffmpeg:<version>-nvidia2004`)
- ubuntu based vaapi images `ffmpeg:<version>-vaapi2404` (old versions with `ffmpeg:<version>-vaapi2004`, `ffmpeg:<version>-vaapi1804`)
- ubuntu based amf images `ffmpeg:<version>-amf2404`

</details>

Expand All @@ -58,6 +60,9 @@ This image is just like the above `ubuntu2404` container image, except we build
**vaapi2404**
Based on `ubuntu2404` with [Video Acceleration API (VAAPI)](https://trac.ffmpeg.org/wiki/HWAccelIntro#VAAPI) enabled.

**amf2404**
Based on `ubuntu2404` with [AMD Advanced Media Framework (AMF)](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/Build-FFmpeg-with-AMF-Support) enabled.

**nvidia2404**
Based on `ubuntu2404` with [NVIDIA's hardware-accelerated encoding and decoding APIs](https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDANVENCNVDEC) enabled.

Expand Down
231 changes: 231 additions & 0 deletions docker-images/8.0/amf2404/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# ffmpeg - http://ffmpeg.org/download.html
#
# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
#
# https://hub.docker.com/r/jrottenberg/ffmpeg/
#
#
# Stage 1: Build
FROM ubuntu:24.04 AS builder


ENV FFMPEG_VERSION=8.0.2

ENV AMD_AMF_VERSION=v1.5.2
ENV AMD_AMF_REPO_URL=https://repo.radeon.com/amf/26.10.1
ENV TZ=Etc/UTC

## opencore-amr - https://sourceforge.net/projects/opencore-amr/
## x264 - http://www.videolan.org/developers/x264.html
## x265 - http://x265.org/ ( videolan )
## libogg - https://www.xiph.org/ogg/ ( xiph )
## libopus - https://www.opus-codec.org/ ( xiph )
## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libopus
## libvorbis - https://xiph.org/vorbis/ ( xiph )
## libvpx - https://www.webmproject.org/code/
## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libvpx
## libwebp - https://developers.google.com/speed/webp/
## libmp3lame - http://lame.sourceforge.net/
## xvid - https://www.xvid.com/ (xvidcore)
## fdk-aac - https://github.com/mstorsjo/fdk-aac
## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libfdk-aac
## openjpeg - https://github.com/uclouvain/openjpeg
## freetype - https://www.freetype.org/
## consider passing --no-install-recommends for this one its globbie (if you do, pass in libfreetype6)
## libvidstab - https://github.com/georgmartius/vid.stab
## fridibi - https://www.fribidi.org/
## fontconfig - https://www.freedesktop.org/wiki/Software/fontconfig/
## libass - https://github.com/libass/libass
## lib aom - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libaom
## libsvtav1 - https://gitlab.com/AOMediaCodec/SVT-AV1.git
## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libsvtav1
## libdav1d - https://code.videolan.org/videolan/dav1d
## - https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#libdav1d
## util-macros - (x.org) (and supporting libraries) for screen capture https://xcb.freedesktop.org/
## xorgproto - (x.org)
## libXau -
## libpthread - libpthread-stubs
## libxml2 - for libbluray
## libbluray - Requires libxml, freetype, and fontconfig
## libzmq - https://github.com/zeromq/libzmq/
## this one pulls in a bunch of dependencies
## libpng - this one also pulls in a bunch of stuff
## libaribb24 -
## zimg - https://github.com/sekrit-twc/zimg
## libtheora - http://www.theora.org/ ( xiph )
## - https://stackoverflow.com/questions/4810996/how-to-resolve-configure-guessing-build-type-failure
## libsrt - https://github.com/Haivision/srt
## Secure Reliable Transport UDP streaming library
## multiple flavors (OpenSSL flavour) and ( GnuTLS flavour)
ARG OPENCORE_PKGS="libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0"
ARG X264_PKGS="libx264-164 libx264-dev"
ARG X265_PKGS="libnuma1 libx265-199 libx265-dev"
# libnuma-dev
ARG OGG_PKGS="libogg-dev libogg0"
ARG OPUS_PKGS="libopus-dev libopus0"
ARG VORBIS_PKGS="libvorbis-dev libvorbis0a libvorbisenc2 libvorbisfile3"
ARG VPX_PKGS="libvpx-dev libvpx9"
ARG WEBP_PKGS="libsharpyuv-dev libsharpyuv0 libwebp-dev libwebp7 libwebpdecoder3 libwebpdemux2 libwebpmux3"
ARG MP3LAME_PKGS="libmp3lame-dev libmp3lame0"
ARG XVIDCORE_PKGS="libxvidcore-dev libxvidcore4"
ARG FDKAAC_PKGS="libfdk-aac-dev libfdk-aac2"
ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev"
# bzip2-doc fontconfig-config fonts-dejavu-core fonts-dejavu-mono libaom3 libbrotli-dev
# libbrotli1 libbsd0 libbz2-dev libc-dev-bin libc-devtools libc6-dev libcrypt-dev libde265-0
# libdeflate0 libfontconfig1 libfreetype6 libgd3 libheif-plugin-aomdec
# libheif-plugin-aomenc libheif-plugin-libde265 libheif1 libjbig0 libjpeg-turbo8
# libjpeg8 liblerc4 libpng-dev libpng-tools libpng16-16t64 libsharpyuv0 libtiff6
# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev
# manpages manpages-dev rpcsvc-proto zlib1g-dev
ARG FREETYPE_PKGS="libfreetype6-dev"
ARG FONTCONFIG_PKGS="fontconfig libfontconfig-dev libfontconfig1 fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1"
ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0"
# libass-dev wanted to install a boat-load of packages
ARG LIBASS_PKGS="libass-dev libass9"
ARG AOM_PKGS="libaom-dev libaom3"
ARG SVTAV1_PKGS="libsvtav1-dev libsvtav1enc-dev libsvtav1enc1d1 libsvtav1dec-dev libsvtav1dec0"
ARG DAV1D_PKGS="libdav1d-dev libdav1d7"
# LIBDRM_PKGS picks ups some of the XORG_MACROS_PKGS as well
ARG XORG_MACROS_PKGS="libxcb-shm0-dev libxcb-shm0 libxcb-xfixes0 libxcb-xfixes0-dev"
ARG XPROTO_PKGS="x11proto-core-dev x11proto-dev"
ARG XAU_PKGS="libxau-dev libxau6"
ARG PTHREADS_STUBS_PKGS="libpthread-stubs0-dev"
ARG XML2_PKGS="libxml2-dev libxml2"
ARG BLURAY_PKGS="libbluray-dev libbluray2"
ARG ZMQ_PKGS="libzmq3-dev libzmq5"
# libpng-tools
ARG PNG_PKGS="libpng-dev libpng16-16t64"
ARG ARIBB24_PKGS="libaribb24-dev"
ARG ZIMG_PKGS="libzimg-dev libzimg2"
ARG THEORA_PKGS="libtheora-dev libtheora0"
ARG SRT_PKGS="libssl-dev libsrt-openssl-dev libsrt1.5-openssl"
ARG LIBDRM_PKGS="libbsd0 libdrm-dev libdrm2 libxcb1-dev libxcb1"

ENV MAKEFLAGS="-j4"
ENV PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/opt/ffmpeg/lib/x86_64-linux-gnu/pkgconfig:/opt/ffmpeg/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig"

ENV PREFIX="/opt/ffmpeg"
ENV LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64:/opt/ffmpeg/lib/aarch64-linux-gnu:/opt/amf/lib/x86_64-linux-gnu"


ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get -yqq update && \
apt-get install -yq --no-install-recommends curl jq python3 python3-requests less tree file vim

RUN buildDeps="autoconf \
automake \
cmake \
build-essential \
texinfo \
curl \
wget \
tar \
bzip2 \
libexpat1-dev \
gcc \
git \
git-core \
gperf \
libtool \
make \
meson \
ninja-build \
nasm \
perl \
pkg-config \
python3 \
yasm \
zlib1g-dev \
libfreetype6-dev \
libgnutls28-dev \
libsdl2-dev \
libva-dev \
libvdpau-dev \
libnuma-dev \
libdav1d-dev \
openssl \
libssl-dev \
expat \
libgomp1" && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}

WORKDIR /tmp/workdir

COPY generate-source-of-truth-ffmpeg-versions.py /tmp/workdir
COPY download_tarballs.sh /tmp/workdir
COPY build_source.sh /tmp/workdir
COPY install_ffmpeg.sh /tmp/workdir



RUN \
echo "Installing dependencies..." && \
apt-get install -yq --no-install-recommends ${OPENCORE_PKGS} ${X264_PKGS} ${X265_PKGS} ${OGG_PKGS} ${OPUS_PKGS} ${VORBIS_PKGS} ${VPX_PKGS} ${WEBP_PKGS} ${MP3LAME_PKGS} ${XVIDCORE_PKGS} ${FDKAAC_PKGS} ${OPENJP_PKGS} ${FREETYPE_PKGS} ${VIDSTAB_PKGS} ${FRIBIDI_PKGS} ${FONTCONFIG_PKGS} ${LIBASS_PKGS} ${AOM_PKGS} ${SVTAV1_PKGS} ${DAV1D_PKGS} ${XORG_MACROS_PKGS} ${XPROTO_PKGS} ${XAU_PKGS} ${PTHREADS_STUBS_PKGS} ${XML2_PKGS} ${BLURAY_PKGS} ${ZMQ_PKGS} ${PNG_PKGS} ${ARIBB24_PKGS} ${ZIMG_PKGS} ${THEORA_PKGS} ${SRT_PKGS} ${LIBDRM_PKGS} tzdata

RUN \
. /etc/os-release && \
codename="${UBUNTU_CODENAME:-${VERSION_CODENAME}}" && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL ${AMD_AMF_REPO_URL}/amf-pub.gpg -o /etc/apt/keyrings/amf-pub.asc && \
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/amf-pub.asc] ${AMD_AMF_REPO_URL}/ubuntu ${codename} main" > /etc/apt/sources.list.d/amf.list && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends amf-amdgpu-pro libamdenc-amdgpu-pro

RUN \
git clone --branch ${AMD_AMF_VERSION} --depth 1 https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git /tmp/amf && \
mkdir -p /usr/local/include/AMF && \
cp -a /tmp/amf/amf/public/include/. /usr/local/include/AMF/ && \
rm -rf /tmp/amf

# apt install libdrm-dev

## libvmaf https://github.com/Netflix/vmaf
## https://github.com/Netflix/vmaf/issues/788#issuecomment-756098059
RUN \
echo "Adding g++ for VMAF build" && \
apt-get install -yq g++

# Note: pass '--library-list lib1,lib2,lib3 for more control.
# Here we have 3 libs that we have to build from source
RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list kvazaar,libvmaf,whisper
RUN /tmp/workdir/download_tarballs.sh
RUN /tmp/workdir/build_source.sh

RUN /tmp/workdir/generate-source-of-truth-ffmpeg-versions.py --library-list ffmpeg-8.0
RUN /tmp/workdir/download_tarballs.sh
RUN /tmp/workdir/build_source.sh

## when debugging you can pass in || true to the end of the command
## to keep the build going even if one of the steps fails
RUN /tmp/workdir/install_ffmpeg.sh



# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04 AS runtime

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get -yqq update && \
apt-get install -yq --no-install-recommends libvulkan1 mesa-vulkan-drivers && \
rm -rf /var/lib/apt/lists/*

# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/
COPY --from=builder /opt/amf /opt/amf/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg

ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/opt/amf/lib/x86_64-linux-gnu

CMD ["--help"]
ENTRYPOINT ["ffmpeg"]
Loading