Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Easily get ffmpeg on Fedora with support for all the things.
# Dockerfile for 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.
#
FROM fedora
MAINTAINER Ross Timson <ross@rosstimson.com>
# Install build requirements.
RUN dnf install -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
# Yasm
RUN cd /usr/local/src \
&& git clone --depth 1 git://github.com/yasm/yasm.git \
&& cd yasm \
&& autoreconf -fiv \
&& ./configure --prefix="/usr/local" \
&& make \
&& make install
# libx264
RUN cd /usr/local/src \
&& git clone --depth 1 git://git.videolan.org/x264 \
&& cd x264 \
&& ./configure --prefix="/usr/local" --enable-static \
&& make \
&& make install
# libx265
RUN cd /usr/local/src \
&& hg clone https://bitbucket.org/multicoreware/x265 \
&& cd /usr/local/src/x265/build/linux \
&& cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local" -DENABLE_SHARED:bool=off ../../source \
&& make \
&& make install
# libfdk_aac
RUN cd /usr/local/src \
&& git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac \
&& cd fdk-aac \
&& autoreconf -fiv \
&& ./configure --prefix="/usr/local" --disable-shared \
&& make \
&& make install
# libmp3lame
RUN cd /usr/local/src \
&& 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 \
&& cd lame-3.99.5 \
&& ./configure --prefix="/usr/local" --disable-shared --enable-nasm \
&& make \
&& make install
# libopus
RUN cd /usr/local/src \
&& git clone https://git.xiph.org/opus.git \
&& cd opus \
&& autoreconf -fiv \
&& ./configure --prefix="/usr/local" --disable-shared \
&& make \
&& make install
# libogg
RUN cd /usr/local/src \
&& curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz \
&& tar xzvf libogg-1.3.2.tar.gz \
&& cd libogg-1.3.2 \
&& ./configure --prefix="/usr/local" --disable-shared \
&& make \
&& make install
# libvorbis
RUN cd /usr/local/src \
&& curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz \
&& tar xzvf libvorbis-1.3.5.tar.gz \
&& cd libvorbis-1.3.5 \
&& ./configure --prefix="/usr/local" --disable-shared \
# LDFLAGS="-L$HOME/ffmeg_build/lib" CPPFLAGS="-I$HOME/ffmpeg_build/include" ./configure --prefix="/usr/local" --with-ogg="$HOME/ffmpeg_build" --disable-shared \
&& make \
&& make install
# libvpx
RUN cd /usr/local/src \
&& git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git \
&& cd libvpx \
&& ./configure --prefix="/usr/local" --as=yasm --disable-examples \
&& make \
&& make install
# ffmpeg
#
# TODO: Work out why freetype support isn't working in order to use: --enable-libfreetype
RUN cd /usr/local/src \
&& git clone --depth 1 git://source.ffmpeg.org/ffmpeg \
&& cd ffmpeg \
&& 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 \
&& make \
&& make install
# Cleanup.
RUN rm -rf /usr/local/src/* \
&& dnf clean all \
&& dnf erase -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
# Define entrypoint so we can use container as if it's a standalone app.
ENTRYPOINT ["/usr/local/bin/ffmpeg"]
#!/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.
#
# Tested on Fedora 22.
#
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 \
mercurial \
nasm \
opus-devel \
pkgconfig \
yasm \
zlib-devel
# libx264
cd /usr/local/src
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --prefix="/usr/local" --enable-static
make
make install
make distclean
# libx265
cd /usr/local/src
hg clone https://bitbucket.org/multicoreware/x265
cd /usr/local/src/x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local" -DENABLE_SHARED:bool=off ../../source
make
make install
# libfdk_aac
cd /usr/local/src
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="/usr/local" --disable-shared
make
make install
make distclean
# libmp3lame
cd /usr/local/src
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
cd lame-3.99.5
./configure --prefix="/usr/local" --disable-shared --enable-nasm
make
make install
make distclean
# ffmpeg
cd /usr/local/src
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
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
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