Skip to content

Instantly share code, notes, and snippets.

@smac89
Last active August 22, 2023 19:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save smac89/7350385735109fb26f2891790cad6694 to your computer and use it in GitHub Desktop.
Save smac89/7350385735109fb26f2891790cad6694 to your computer and use it in GitHub Desktop.
Install latest version of ffmpeg on Ubuntu
#!/bin/bash
sudo apt-get update
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
# Create a dir where the rest of the sources will live
mkdir ~/ffmpeg_sources
######### yasm ##########
sudo apt-get -y install yasm
# If your version of yasm is < 1.2.0,
# uncomment the following lines to get the lastest
# cd ~/ffmpeg_sources
# git clone --depth=1 --no-single-branch https://github.com/yasm/yasm.git
# cd yasm
# git checkout `git tag --list | tail -1` -b latest
# ./autogen
# ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
# make
# make install
# make distclean
###### libx264 ########
sudo apt-get -y install libx264-dev
# If your version of libx264-dev is less than 0.118,
# uncomment the following lines to get the latest
# cd ~/ffmpeg_sources
# wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
# tar xjvf last_x264.tar.bz2
# cd x264-snapshot*
# PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
# PATH="$HOME/bin:$PATH" make
# make install
# make distclean
###### libx265 #######
sudo apt-get -y install cmake mercurial
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install
make distclean
###### libfdk-aac ########
cd ~/ffmpeg_sources
wget https://github.com/mstorsjo/fdk-aac/tarball/master -O fdk-aac.tar.gz
tar xzvf fdk-aac.tar.gz
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
####### libmp3lame ########
cd ~/ffmpeg_sources
wget https://sourceforge.net/projects/lame/files/latest/download -O liblamemp3
tar xzvf liblamemp3
cd lame-*
./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
make
make install
make distclean
######### libopus #########
cd ~/ffmpeg_sources
git clone --depth=1 --no-single-branch https://github.com/xiph/opus.git
cd opus
git checkout `git tag --list | tail -1` -b latest
./autogen.sh
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make clean
####### libvpx #########
cd ~/ffmpeg_sources
git clone --depth=1 --no-single-branch https://github.com/webmproject/libvpx.git
cd libvpx
git checkout `git tag --list | tail -1` -b latest
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests
PATH="$HOME/bin:$PATH" make
make install
make clean
######## Finally install ffmpeg #########
cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree
PATH="$HOME/bin:$PATH" make
make install
make distclean
hash -r
@smac89
Copy link
Author

smac89 commented Jun 23, 2016

Only tested on Ubuntu 16.04 xenial

This is an extension of this guide, but tries to use the latest version of the files mentioned

@cronnelly
Copy link

Many thanks for this.

Line 64 should read: tar xzvf liblamemp3

@smac89
Copy link
Author

smac89 commented Nov 29, 2016

@cronnelly

Thanks for spotting the error and you're welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment