docker-ffmpeg/Dockerfile.aarch64
2025-03-10 16:31:13 -04:00

748 lines
18 KiB
Docker

# syntax=docker/dockerfile:1
# build stage
FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-noble as buildstage
# set version label
ARG FFMPEG_VERSION
# common env
ENV \
DEBIAN_FRONTEND="noninteractive" \
MAKEFLAGS="-j4" \
PATH="/root/.cargo/bin:${PATH}"
# versions
ENV \
AOM=v3.12.0 \
FDKAAC=2.0.3 \
FFMPEG_HARD=7.1.1 \
FONTCONFIG=2.16.0 \
FREETYPE=2.13.3 \
FRIBIDI=1.0.16 \
HARFBUZZ=10.4.0 \
KVAZAAR=2.3.1 \
LAME=3.100 \
LIBASS=0.17.3 \
LIBDAV1D=1.5.1 \
LIBLC3=1.1.3 \
LIBPNG=1.6.47 \
LIBVA=2.22.0 \
LIBVDPAU=1.5 \
LIBVIDSTAB=1.1.1 \
LIBVMAF=3.0.0 \
NVCODEC=n13.0.19.0 \
OGG=1.3.5 \
OPENCOREAMR=0.1.6 \
OPENJPEG=2.5.3 \
OPUS=1.5.2 \
RAV1E=0.7.1 \
RIST=0.2.11 \
SRT=1.5.4 \
SVTAV1=3.0.0 \
THEORA=1.1.1 \
VORBIS=1.3.7 \
VPX=1.15.0 \
VVENC=1.13.0 \
WEBP=1.5.0 \
X265=4.1 \
XVID=1.3.7 \
ZIMG=3.0.5 \
ZMQ=v4.3.5
RUN \
echo "**** install build packages ****" && \
apt-get update && \
apt-get install -y \
autoconf \
automake \
build-essential \
bzip2 \
cmake \
clang \
diffutils \
g++ \
g++-12 \
gcc \
gcc-12 \
git \
gperf \
libasound2-dev \
libcairo2-dev \
libexpat1-dev \
libgcc-10-dev \
libglib2.0-dev \
libgomp1 \
libharfbuzz-dev \
libpciaccess-dev \
libssl-dev \
libtool \
libv4l-dev \
libx11-dev \
libxext-dev \
libxml2-dev \
llvm-18-dev \
make \
nasm \
perl \
pkg-config \
python3-venv \
x11proto-xext-dev \
xxd \
yasm \
zlib1g-dev && \
mkdir -p /tmp/rust && \
RUST_VERSION=$(curl -fsX GET https://api.github.com/repos/rust-lang/rust/releases/latest | jq -r '.tag_name') && \
curl -fo /tmp/rust.tar.gz -L "https://static.rust-lang.org/dist/rust-${RUST_VERSION}-aarch64-unknown-linux-gnu.tar.gz" && \
tar xf /tmp/rust.tar.gz -C /tmp/rust --strip-components=1 && \
cd /tmp/rust && \
./install.sh && \
cargo install cargo-c && \
python3 -m venv /lsiopy && \
pip install -U --no-cache-dir \
pip \
setuptools \
wheel && \
pip install --no-cache-dir cmake meson ninja
# compile 3rd party libs
RUN \
echo "**** grabbing aom ****" && \
mkdir -p /tmp/aom && \
git clone \
--branch ${AOM} \
--depth 1 https://aomedia.googlesource.com/aom \
/tmp/aom
RUN \
echo "**** compiling aom ****" && \
cd /tmp/aom && \
rm -rf \
CMakeCache.txt \
CMakeFiles && \
mkdir -p \
aom_build && \
cd aom_build && \
cmake \
-DBUILD_STATIC_LIBS=0 .. && \
make && \
make install
RUN \
echo "**** grabbing fdk-aac ****" && \
mkdir -p /tmp/fdk-aac && \
curl -Lf \
https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/fdk-aac
RUN \
echo "**** compiling fdk-aac ****" && \
cd /tmp/fdk-aac && \
autoreconf -fiv && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libfdk-aac.so
RUN \
echo "**** grabbing ffnvcodec ****" && \
mkdir -p /tmp/ffnvcodec && \
git clone \
--branch ${NVCODEC} \
--depth 1 https://github.com/FFmpeg/nv-codec-headers.git \
/tmp/ffnvcodec
RUN \
echo "**** compiling ffnvcodec ****" && \
cd /tmp/ffnvcodec && \
make install
RUN \
echo "**** grabbing freetype ****" && \
mkdir -p /tmp/freetype && \
curl -Lf \
https://downloads.sourceforge.net/project/freetype/freetype2/${FREETYPE}/freetype-${FREETYPE}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/freetype
RUN \
echo "**** compiling freetype ****" && \
cd /tmp/freetype && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libfreetype.so
RUN \
echo "**** grabbing fontconfig ****" && \
mkdir -p /tmp/fontconfig && \
curl -Lf \
https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG}.tar.xz | \
tar -xJ --strip-components=1 -C /tmp/fontconfig
RUN \
echo "**** compiling fontconfig ****" && \
cd /tmp/fontconfig && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libfontconfig.so
RUN \
echo "**** grabbing fribidi ****" && \
mkdir -p /tmp/fribidi && \
curl -Lf \
https://github.com/fribidi/fribidi/archive/v${FRIBIDI}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/fribidi
RUN \
echo "**** compiling fribidi ****" && \
cd /tmp/fribidi && \
./autogen.sh && \
./configure \
--disable-static \
--enable-shared && \
make -j 1 && \
make install && \
strip -d /usr/local/lib/libfribidi.so
RUN \
echo "**** grabbing harfbuzz ****" && \
mkdir -p /tmp/harfbuzz && \
curl -Lf \
https://github.com/harfbuzz/harfbuzz/archive/${HARFBUZZ}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/harfbuzz
RUN \
echo "**** compiling harfbuzz ****" && \
cd /tmp/harfbuzz && \
meson build && \
ninja -C build install && \
strip -d /usr/local/lib/aarch64-linux-gnu/libharfbuzz*.so
RUN \
echo "**** grabbing kvazaar ****" && \
mkdir -p /tmp/kvazaar && \
curl -Lf \
https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/kvazaar
RUN \
echo "**** compiling kvazaar ****" && \
cd /tmp/kvazaar && \
./autogen.sh && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libkvazaar.so
RUN \
echo "**** grabbing lame ****" && \
mkdir -p /tmp/lame && \
curl -Lf \
http://downloads.sourceforge.net/project/lame/lame/${LAME}/lame-${LAME}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/lame
RUN \
echo "**** compiling lame ****" && \
cd /tmp/lame && \
cp \
/usr/share/automake-1.16/config.guess \
config.guess && \
cp \
/usr/share/automake-1.16/config.sub \
config.sub && \
./configure \
--disable-frontend \
--disable-static \
--enable-nasm \
--enable-shared && \
make && \
make install
RUN \
echo "**** grabbing libass ****" && \
mkdir -p /tmp/libass && \
curl -Lf \
https://github.com/libass/libass/archive/${LIBASS}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/libass
RUN \
echo "**** compiling libass ****" && \
cd /tmp/libass && \
./autogen.sh && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libass.so
RUN \
echo "**** grabbing libdav1d ****" && \
mkdir -p /tmp/libdav1d && \
git clone \
--branch ${LIBDAV1D} \
https://code.videolan.org/videolan/dav1d \
/tmp/libdav1d
RUN \
echo "**** compiling libdav1d ****" && \
mkdir -p /tmp/libdav1d/build && \
cd /tmp/libdav1d/build && \
meson setup .. && \
ninja install
RUN \
echo "**** grabbing liblc3 ****" && \
mkdir -p /tmp/liblc3 && \
git clone \
--branch v${LIBLC3} \
--depth 1 \
https://github.com/google/liblc3.git \
/tmp/liblc3
RUN \
echo "**** compiling liblc3 ****" && \
cd /tmp/liblc3 && \
meson setup build && \
meson install -C build --strip
RUN \
echo "**** grabbing vmaf ****" && \
mkdir -p /tmp/vmaf && \
curl -Lf \
https://github.com/Netflix/vmaf/archive/refs/tags/v${LIBVMAF}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vmaf
RUN \
echo "**** compiling libvmaf ****" && \
cd /tmp/vmaf/libvmaf && \
meson setup \
--prefix=/usr --libdir=/usr/local/lib \
--buildtype release \
build && \
ninja -vC build && \
ninja -vC build install
RUN \
echo "**** grabbing ogg ****" && \
mkdir -p /tmp/ogg && \
curl -Lf \
http://downloads.xiph.org/releases/ogg/libogg-${OGG}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/ogg
RUN \
echo "**** compiling ogg ****" && \
cd /tmp/ogg && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install
RUN \
echo "**** grabbing opencore-amr ****" && \
mkdir -p /tmp/opencore-amr && \
curl -Lf \
http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/opencore-amr
RUN \
echo "**** compiling opencore-amr ****" && \
cd /tmp/opencore-amr && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libopencore-amr*.so
RUN \
echo "**** grabbing openjpeg ****" && \
mkdir -p /tmp/openjpeg && \
curl -Lf \
https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/openjpeg
RUN \
echo "**** compiling openjpeg ****" && \
cd /tmp/openjpeg && \
rm -Rf \
thirdparty/libpng/* && \
curl -Lf \
https://download.sourceforge.net/libpng/libpng-${LIBPNG}.tar.gz | \
tar -zx --strip-components=1 -C thirdparty/libpng/ && \
cmake \
-DBUILD_STATIC_LIBS=0 \
-DBUILD_THIRDPARTY:BOOL=ON . && \
make && \
make install
RUN \
echo "**** grabbing opus ****" && \
mkdir -p /tmp/opus && \
curl -Lf \
https://downloads.xiph.org/releases/opus/opus-${OPUS}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/opus
RUN \
echo "**** compiling opus ****" && \
cd /tmp/opus && \
autoreconf -fiv && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install && \
strip -d /usr/local/lib/libopus.so
RUN \
echo "**** grabbing rav1e ****" && \
mkdir -p /tmp/rav1e && \
git clone \
--branch v${RAV1E} \
https://github.com/xiph/rav1e.git \
/tmp/rav1e
RUN \
echo "**** compiling rav1e ****" && \
cd /tmp/rav1e && \
cargo cinstall --release && \
strip -d /usr/local/lib/librav1e.so
RUN \
echo "**** grabbing rist ****" && \
mkdir -p /tmp/rist && \
git clone \
--branch v${RIST} \
--depth 1 https://code.videolan.org/rist/librist.git \
/tmp/rist
RUN \
echo "**** compiling rist ****" && \
cd /tmp/rist && \
mkdir -p \
rist_build && \
cd rist_build && \
meson setup \
--default-library=shared .. && \
ninja && \
ninja install && \
strip -d /usr/local/lib/librist.so
RUN \
echo "**** grabbing srt ****" && \
mkdir -p /tmp/srt && \
git clone \
--branch v${SRT} \
--depth 1 https://github.com/Haivision/srt.git \
/tmp/srt
RUN \
echo "**** compiling srt ****" && \
cd /tmp/srt && \
mkdir -p \
srt_build && \
cd srt_build && \
cmake \
-DBUILD_SHARED_LIBS:BOOL=on .. && \
make && \
make install && \
strip -d /usr/local/lib/libsrt.so
RUN \
echo "**** grabbing SVT-AV1 ****" && \
mkdir -p /tmp/svt-av1 && \
curl -Lf \
https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${SVTAV1}/SVT-AV1-v${SVTAV1}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/svt-av1
RUN \
echo "**** compiling SVT-AV1 ****" && \
cd /tmp/svt-av1/Build && \
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \
make && \
make install
RUN \
echo "**** grabbing theora ****" && \
mkdir -p /tmp/theora && \
curl -Lf \
http://downloads.xiph.org/releases/theora/libtheora-${THEORA}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/theora
RUN \
echo "**** compiling theora ****" && \
cd /tmp/theora && \
cp \
/usr/share/automake-1.16/config.guess \
config.guess && \
cp \
/usr/share/automake-1.16/config.sub \
config.sub && \
curl -fL \
'https://gitlab.xiph.org/xiph/theora/-/commit/7288b539c52e99168488dc3a343845c9365617c8.diff' \
> png.patch && \
patch ./examples/png2theora.c < png.patch && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install
RUN \
echo "**** grabbing vid.stab ****" && \
mkdir -p /tmp/vid.stab && \
curl -Lf \
https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vid.stab
RUN \
echo "**** compiling vid.stab ****" && \
cd /tmp/vid.stab && \
echo "" > \
CMakeModules/FindSSE.cmake && \
cmake . && \
make && \
make install
RUN \
echo "**** grabbing vorbis ****" && \
mkdir -p /tmp/vorbis && \
curl -Lf \
http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vorbis
RUN \
echo "**** compiling vorbis ****" && \
cd /tmp/vorbis && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install
RUN \
echo "**** grabbing vpx ****" && \
mkdir -p /tmp/vpx && \
curl -Lf \
https://github.com/webmproject/libvpx/archive/v${VPX}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/vpx
RUN \
echo "**** compiling vpx ****" && \
cd /tmp/vpx && \
./configure \
--disable-debug \
--disable-docs \
--disable-examples \
--disable-install-bins \
--disable-static \
--disable-unit-tests \
--enable-pic \
--enable-shared \
--enable-vp8 \
--enable-vp9 \
--enable-vp9-highbitdepth && \
make && \
make install
RUN \
echo "**** grabbing vvenc ****" && \
mkdir -p /tmp/vvenc && \
git clone \
--branch v${VVENC} \
--depth 1 https://github.com/fraunhoferhhi/vvenc.git \
/tmp/vvenc
RUN \
echo "**** compiling vvenc ****" && \
cd /tmp/vvenc && \
CC=/usr/bin/gcc-12 CXX=/usr/bin/g++-12 make install install-prefix=/usr/local && \
strip -d /usr/local/lib/libvvenc.so
RUN \
echo "**** grabbing webp ****" && \
mkdir -p /tmp/webp && \
curl -Lf \
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/webp
RUN \
echo "**** compiling webp ****" && \
cd /tmp/webp && \
./configure && \
make && \
make install && \
strip -d /usr/local/lib/libweb*.so
RUN \
echo "**** grabbing x264 ****" && \
mkdir -p /tmp/x264 && \
curl -Lf \
https://code.videolan.org/videolan/x264/-/archive/master/x264-stable.tar.bz2 | \
tar -jx --strip-components=1 -C /tmp/x264
RUN \
echo "**** compiling x264 ****" && \
cd /tmp/x264 && \
./configure \
--disable-cli \
--disable-static \
--enable-pic \
--enable-shared && \
make && \
make install
RUN \
echo "**** grabbing x265 ****" && \
mkdir -p /tmp/x265 && \
curl -Lf \
https://bitbucket.org/multicoreware/x265_git/downloads/x265_${X265}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/x265
RUN \
echo "**** compiling x265 ****" && \
cd /tmp/x265/build/linux && \
export CXXFLAGS="-fPIC" && \
./multilib.sh && \
make -C 8bit install
RUN \
echo "**** grabbing xvid ****" && \
mkdir -p /tmp/xvid && \
curl -Lf \
https://downloads.xvid.com/downloads/xvidcore-${XVID}.tar.gz | \
tar -zx --strip-components=1 -C /tmp/xvid
RUN \
echo "**** compiling xvid ****" && \
cd /tmp/xvid/build/generic && \
./configure && \
make && \
make install
RUN \
echo "**** grabbing zimg ****" && \
mkdir -p /tmp/zimg && \
git clone \
--branch release-${ZIMG} --depth 1 \
https://github.com/sekrit-twc/zimg.git \
/tmp/zimg
RUN \
echo "**** compiling zimg ****" && \
cd /tmp/zimg && \
./autogen.sh && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install
RUN \
echo "**** grabbing zmq ****" && \
mkdir -p /tmp/zmq && \
git clone \
--branch ${ZMQ} --depth 1 \
https://github.com/zeromq/libzmq.git \
/tmp/zmq
RUN \
echo "**** compiling zmq ****" && \
cd /tmp/zmq && \
./autogen.sh && \
./configure \
--disable-static \
--enable-shared && \
make && \
make install-strip
# main ffmpeg build
RUN \
echo "**** Versioning ****" && \
if [ -z ${FFMPEG_VERSION+x} ]; then \
FFMPEG=${FFMPEG_HARD}; \
else \
FFMPEG=${FFMPEG_VERSION%-cli}; \
fi && \
echo "**** grabbing ffmpeg ****" && \
mkdir -p /tmp/ffmpeg && \
echo "https://ffmpeg.org/releases/ffmpeg-${FFMPEG}.tar.bz2" && \
curl -Lf \
https://ffmpeg.org/releases/ffmpeg-${FFMPEG}.tar.bz2 | \
tar -jx --strip-components=1 -C /tmp/ffmpeg
RUN \
echo "**** compiling ffmpeg ****" && \
cd /tmp/ffmpeg && \
./configure \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-libdrm \
--enable-alsa \
--enable-cuda-llvm \
--enable-cuvid \
--enable-ffprobe \
--enable-gpl \
--enable-libaom \
--enable-libass \
--enable-libdav1d \
--enable-libfdk_aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-liblc3 \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenjpeg \
--enable-libopus \
--enable-librav1e \
--enable-librist \
--enable-libsrt \
--enable-libsvtav1 \
--enable-libtheora \
--enable-libv4l2 \
--enable-libvidstab \
--enable-libvmaf \
--enable-libvorbis \
--enable-libvpx \
--enable-libvvenc \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxml2 \
--enable-libxvid \
--enable-libzimg \
--enable-libzmq \
--enable-nonfree \
--enable-nvdec \
--enable-nvenc \
--enable-openssl \
--enable-stripping \
--enable-version3 \
&& \
make
RUN \
echo "**** arrange files ****" && \
/usr/local/lib/rustlib/uninstall.sh && \
ldconfig && \
mkdir -p \
/buildout/usr/local/bin \
/buildout/usr/local/etc/fonts \
/buildout/usr/local/lib/aarch64-linux-gnu \
/buildout/usr/share/fonts && \
cp \
/tmp/ffmpeg/ffmpeg \
/buildout/usr/local/bin && \
cp \
/tmp/ffmpeg/ffprobe \
/buildout/usr/local/bin && \
cp -a \
/usr/local/etc/fonts/* \
/buildout/usr/local/etc/fonts/ && \
cp -a \
/usr/local/lib/lib*so* \
/buildout/usr/local/lib/ && \
cp -a \
/usr/local/lib/aarch64-linux-gnu/lib*so* \
/buildout/usr/local/lib/aarch64-linux-gnu/ && \
cp -a \
/usr/share/fonts/* \
/buildout/usr/share/fonts/
# runtime stage
FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-noble
# Add files from binstage
COPY --from=buildstage /buildout/ /
# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thelamer"
ARG DEBIAN_FRONTEND="noninteractive"
ENV \
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \
NVIDIA_VISIBLE_DEVICES="all"
RUN \
echo "**** install runtime ****" && \
apt-get update && \
apt-get install -y \
libasound2t64 \
libexpat1 \
libglib2.0-0 \
libgomp1 \
libllvm18 \
libv4l-0 \
libx11-6 \
libxcb1 \
libxcb-shm0 \
libxext6 \
libxml2 \
ocl-icd-libopencl1 && \
echo "**** clean up ****" && \
rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* && \
echo "**** quick test ffmpeg ****" && \
ldd /usr/local/bin/ffmpeg && \
/usr/local/bin/ffmpeg -version
COPY /root /
ENTRYPOINT ["/ffmpegwrapper.sh"]