FFmpeg 6.1

ウェブページ

https://www.ffmpeg.org/

バージョン

6.1

ビルド環境

  • autoconf 2.72

ビルドに必要なファイル

  • ffmpeg-6.1.tar.xz

ビルド手順

#!/bin/sh

VERSION=6.1

SOURCEDIR=/home/users/${USER}/Software/FFmpeg/${VERSION}
INSTALLDIR=/apl/ffmpeg/${VERSION}
TARBALL=${SOURCEDIR}/ffmpeg-${VERSION}.tar.xz
WORKDIR=/gwork/users/${USER}

# external
NASMVER=2.16.01
NASMURL=https://www.nasm.us/pub/nasm/releasebuilds/${NASMVER}/nasm-${NASMVER}.tar.bz2

YASMVER=1.3.0
YASMURL=https://www.tortall.net/projects/yasm/releases/yasm-${YASMVER}.tar.gz

X264GIT=https://code.videolan.org/videolan/x264.git
X265GIT=https://bitbucket.org/multicoreware/x265_git

#FDKAACGIT=https://github.com/mstorsjo/fdk-aac

MP3LAMEVER=3.100
MP3LAMEURL=https://downloads.sourceforge.net/project/lame/lame/${MP3LAMEVER}/lame-${MP3LAMEVER}.tar.gz

OPUSVER=1.4
OPUSURL=https://downloads.xiph.org/releases/opus/opus-${OPUSVER}.tar.gz

VPXGIT=https://chromium.googlesource.com/webm/libvpx.git

PARALLEL=12
export LANG=C

#--------------------------------------------------------------------------
umask 0022
ulimit -s unlimited

cd ${WORKDIR}
if [ -d ffmpeg-${VERSION} ]; then
  mv ffmpeg-${VERSION} ffmpeg-erase
  rm -rf ffmpeg-erase &
fi

module -s purge
module -s load autoconf/2.72

# remember this directory
FFMPEG_WORKDIR=${WORKDIR}/ffmpeg-${VERSION}
export PATH="${INSTALLDIR}/bin:${PATH}"
export PKG_CONFIG_PATH="${INSTALLDIR}/lib/pkgconfig"

tar Jxf ${TARBALL}

# build NASM
cd ${FFMPEG_WORKDIR}
curl -O -L ${NASMURL}
tar xjf nasm-${NASMVER}.tar.bz2
cd nasm-${NASMVER}
./autogen.sh
./configure --prefix=${INSTALLDIR}
make
make install

# build Yasm
cd ${FFMPEG_WORKDIR}
curl -O -L ${YASMURL}
tar zxf yasm-${YASMVER}.tar.gz
cd yasm-${YASMVER}
./configure --prefix=${INSTALLDIR}
make
make install

# build libx264
cd ${FFMPEG_WORKDIR}
git clone --branch stable --depth 1 ${X264GIT}
cd x264
PKG_CONFIG_PATH="${INSTALLDIR}/lib/pkgconfig" ./configure --prefix=${INSTALLDIR} --enable-static
make
make install

# build libx265
cd ${FFMPEG_WORKDIR}
git clone --branch stable --depth 2 ${X265GIT}
cd x265_git/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${INSTALLDIR} -DENABLE_SHARED:bool=off ../../source
make
make install

## build libfdk_aac
#cd ${FFMPEG_WORKDIR}
#git clone --depth 1 ${FDKAACGIT}
#cd fdk-aac
#autoreconf -fiv
#./configure --prefix=${INSTALLDIR} --disable-shared
#make
#make install

# build libmp3lame
cd ${FFMPEG_WORKDIR}
curl -O -L ${MP3LAMEURL}
tar xzf lame-${MP3LAMEVER}.tar.gz
cd lame-${MP3LAMEVER}
./configure --prefix=${INSTALLDIR} --disable-shared --enable-nasm
make
make install

# build libopus
cd ${FFMPEG_WORKDIR}
curl -O -L ${OPUSURL}
tar zxf opus-${OPUSVER}.tar.gz
cd opus-${OPUSVER}
./configure --prefix=${INSTALLDIR} --disable-shared
make
make install

# build libvpx
cd ${FFMPEG_WORKDIR}
git clone --depth 1 ${VPXGIT}
cd libvpx
./configure --prefix=${INSTALLDIR} --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install

# ffmpeg
cd ${FFMPEG_WORKDIR}
./configure --prefix=${INSTALLDIR} \
            --pkg-config-flags="--static" \
            --extra-cflags="-I${INSTALLDIR}/include" \
            --extra-ldflags="-L${INSTALLDIR}/lib" \
            --extra-libs=-lpthread \
            --extra-libs=-lm \
            --bindir="${INSTALLDIR}/bin" \
            --enable-gpl \
            --enable-libfreetype \
            --enable-libmp3lame \
            --enable-libopus \
            --enable-libvpx \
            --enable-libx264 \
            --enable-libx265
            #--enable-libfdk_aac \
make
make install

メモ

  • A100/A30 では NVENC によるエンコードの高速化が期待できないため、GPU 対応は回避
    • https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new
    • デコードについては A100/A30 でもハードウェアアクセラレーションが可能と思われます
  • fdk_aac は念のため回避。