Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantmcwilliams/92f323b293123bbfbdc34d7a185f587a to your computer and use it in GitHub Desktop.
Save grantmcwilliams/92f323b293123bbfbdc34d7a185f587a to your computer and use it in GitHub Desktop.
A script to compile ffmpeg including libx264, libx265, libfdk_aac, libmp3lame on Fedora 38.
#!/usr/bin/env bash
# Build ffmpeg with pretty much support for everything as per:
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
# includes codecs with weird licensing like MP3 and AAC.
#
# Updated for Fedora 38
# Tested on Fedora 38.
#
set -eux
# Install build requirements.
dnf install -y \
autoconf \
automake \
cmake \
freetype-devel \
gcc \
gcc-c++ \
git \
libogg-devel \
libtool \
libvorbis-devel \
libvpx-devel \
make \
nasm \
opus-devel \
pkgconfig \
yasm \
zlib-devel \
libxcb-devel
# libx264
cd /usr/local/src
if [[ -d x264 ]] ;then
cd x264
git pull --depth 1 https://code.videolan.org/videolan/x264.git
else
git clone --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
fi
./configure --prefix="/usr/local" --enable-static
make
make install
make distclean
# libx265
cd /usr/local/src
if [[ -d x265_git ]] ;then
cd x265_git/build/linux
git pull
else
git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git
cd x265_git/build/linux
fi
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local" -DENABLE_SHARED:bool=off ../../source
make
make install
# libfdk_aac
cd /usr/local/src
if [[ -d fdk-aac ]] ;then
cd fdk-aac
git pull
else
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac
fi
autoreconf -fiv
./configure --prefix="/usr/local" --disable-shared
make
make install
make distclean
# libmp3lame
cd /usr/local/src
if [[ ! -d lame-3.99.5 ]] ;then
curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
fi
cd lame-3.99.5
./configure --prefix="/usr/local" --disable-shared --enable-nasm
make
make install
make distclean
# ffmpeg
cd /usr/local/src
if [[ -d ffmpeg ]] ;then
cd ffmpeg
git pull
else
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
fi
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --prefix="/usr/local" --extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --extra-libs="-lpthread" --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape
make
make install
make distclean
hash -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment