Skip to content

Instantly share code, notes, and snippets.

@tschneid
Last active March 27, 2016 14:19
Show Gist options
  • Save tschneid/dcd30b903e67cf09e680 to your computer and use it in GitHub Desktop.
Save tschneid/dcd30b903e67cf09e680 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This is the adapted version from
# https://gist.githubusercontent.com/mkassner/1caa1b45c19521c884d5/raw/b5ce332808b8e26406af0db78115761ea605441c/install_ffmpeg_ubuntu.sh
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
echo "Installing in $WORKING_DIR ..."
# Remove any existing packages:
apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev yasm
# Get the dependencies (Ubuntu Server or headless users):
# (removed libfaac-dev)
apt-get update
apt-get -y install build-essential checkinstall git libgpac-dev \
libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev \
libvorbis-dev pkg-config texi2html yasm zlib1g-dev libasound2-dev
cd $WORKING_DIR
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xvzf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
# Install x264
# apt-get -y install libx264-dev
cd $WORKING_DIR
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --enable-shared
make
checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
--fstrans=no --default
# Install AAC audio decoder
cd $WORKING_DIR
wget http://downloads.sourceforge.net/opencore-amr/fdk-aac-0.1.0.tar.gz
tar xzvf fdk-aac-0.1.0.tar.gz
cd fdk-aac-0.1.0
./configure --enable-shared
make
checkinstall --pkgname=fdk-aac --pkgversion="0.1.0" --backup=no \
--deldoc=yes --fstrans=no --default
# Install VP8 video encoder and decoder.
cd $WORKING_DIR
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx
cd libvpx
./configure --enable-shared
make
checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
# Add lavf support to x264
# This allows x264 to accept just about any input that FFmpeg can handle and is useful if you want to use x264 directly. See a more detailed explanation of what this means.
cd $WORKING_DIR/x264
make distclean
./configure --enable-static --enable-shared --enable-pic
make
checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
--fstrans=no --default
#install XVID
cd $WORKING_DIR
wget 'http://mirror.ryansanden.com/ffmpeg-d00bc6a8/xvidcore-1.3.2.tar.gz'
tar -xzf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure --prefix='/usr/local'
make # 15 sec
make install
#checkinstall --pkgname=xvidcore --pkgversion="1.3.2" --backup=no --deldoc=yes \
# --fstrans=no --default
# Installing FFmpeg
cd $WORKING_DIR
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-shared --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis \
--enable-libx264 --enable-nonfree --enable-version3 --enable-libxvid
make
make install
#finsh up:
ldconfig
# Optional: install qt-faststart
# This is a useful tool if you're showing your H.264 in MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: qt-faststart input.mp4 output.mp4.
# cd ~/ffmpeg
# make tools/qt-faststart
# checkinstall --pkgname=qt-faststart --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
# --deldoc=yes --fstrans=no --default install -Dm755 tools/qt-faststart \
# /usr/local/bin/qt-faststart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment