1. Andrew's Corner »
  2. Ubuntu: some memories :

Compile vlc-git under the latest Ubuntu release...

This guide details how to install the development version of vlc using both 32 bit and 64 bit versions of the latest Ubuntu release, it owes a huge debt to the vlc Slackbuild of Eric Hameleers, otherwise known as alienBOB. This guide will be periodically updated for each new stable Ubuntu version.

  1. Some Preparation: Install -dev files, compilers & create a build area..
    1. Compiling libfdk-aac: Compile and install the best aac encoding library available to Linux.
    2. Building x264: Install the latest x264 so vlc can produce h.264 streams.
    3. Building x265: Install the latest x265 so vlc can produce hevc streams.
    4. Compiling live555: Install a recent live555 so vlc can read some streams.
    5. Building FFmpeg: Compiling and installing a recent copy of FFmpeg, the cornerstone of vlc's versatility!
    6. DVD Playback Adding the required libraries to enable DVD Playback with vlc-git.
  2. Compiling vlc: Download, compile and install vlc-git. Also instructions to periodically update.
  3. Latest successful compile: Details of the latest git and date successfully compiled with this guide.

I emphasise at the outset that this development version of vlc will be broken at times and should only ever be installed by those willing to experiment a little, people who are used to running alpha or beta version software. The preferred method to build and test vlc-git is from within a Virtual Machine dedicated to this purpose alone, this is my own model in writing and testing this guide and I strongly recommend this method to all who follow the guide.

Preparation: Vivid Vervet..

As a first step it is a good idea to remove all previous vlc packages using either the Terminal, Synaptic or the Software Centre. Then some basic tools are required for compiling and we will also create the build location, the following is a single command which can simply be copied from here and pasted into a Terminal window:

sudo apt-get -y install build-essential git-core checkinstall \
automake yasm cmake && mkdir -pv $HOME/vlc_build

A considerable volume of 'development' files is also required and we will also install the required decryption library for dvd playback. The following is a single command:

sudo apt-get -y install liba52-0.7.4-dev libaa1-dev libasound2-dev libass-dev \
libavahi-client-dev libcaca-dev libcairo2-dev libcddb2-dev libcdio-dev libdca-dev \
libdirac-dev libdvbpsi-dev libebml-dev libfaad-dev \
libflac-dev libfreetype6-dev libfribidi-dev libgcrypt11-dev libgl1-mesa-dev \
libglib2.0-0 libgnutls28-dev libid3tag0-dev libjack-jackd2-dev libkate-dev \
liblircclient-dev liblua5.1-0-dev libmad0-dev libmatroska-dev libmodplug-dev \
libmpcdec-dev libmpeg2-4-dev libmtp-dev libncursesw5-dev libnotify-dev libogg-dev \
liboggkate-dev libpango1.0-dev libpng12-dev libprojectm-dev libprojectm-qt-dev \
libproxy-dev libpulse-dev libqt4-dev libraw1394-dev librsvg2-dev libschroedinger-dev \
libsdl-image1.2-dev libsdl1.2-dev libshout3-dev libsmbclient-dev libspeex-dev \
libsqlite3-dev libsvga1-dev libsysfs-dev libtag1-dev libtar-dev libgme-dev \
libtheora-dev libtool libtwolame-dev libudev-dev libupnp-dev libv4l-dev libvcdinfo-dev \
libvorbis-dev libva-dev libvpx-dev libx11-dev libx11-xcb-dev libxcb-composite0-dev \
libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xv0-dev libxcb-xvmc0-dev \
libxcb1-dev libxext-dev libxml2-dev libxpm-dev libxt-dev libxv-dev libzvbi-dev lua5.1 \
qt4-qtconfig libspeexdsp-dev libsamplerate0-dev libvdpau-dev libxpm-dev libxinerama-dev \
libtar-dev libgtk2.0-dev libdc1394-22-dev libopus-dev libmpg123-dev protobuf-c-compiler

Feel free to experiment a little with these development files to match your needs but the ones given here will outfit you with a reasonably well equipped vlc. Now to add the libraries for fdk-aac which vlc will use (via FFmpeg) for aac encoding:

libfdk-aac...

libfdk-aac is in the Ubuntu Repositories but only version 1.3 and since 1.4 has some substantial fixes in place we will be compiling the newer version:

Installing libfdk-aac:

if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--with-pic"
 else
  ARCHOPTS=""
fi && \
cd $HOME/vlc_build && \
wget --content-disposition https://github.com/mstorsjo/fdk-aac/archive/v0.1.4.tar.gz && \
tar xvf fdk-aac-0.1.4.tar.gz && cd fdk-aac-0.1.4 && \
autoreconf -fiv && \
./configure --prefix=$HOME/vlc_build/vlcdeps/usr \
            $ARCHOPTS \
            --disable-shared \
            --enable-static && \
make && make install && make distclean

Removing libfdk-aac:

To remove all traces of libfdk-aac, including the installed libraries, the expanded source and the downloaded source archive use the following:

rm -rfv $HOME/vlc_build/vlcdeps/usr/include/fdk-aac && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/libfdk-aac* && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/pkgconfig/fdk-aac.pc && \
rm -rfv $HOME/vlc_build/fdk-aac-0.1.4 && rm $HOME/vlc_build/fdk-aac-0.1.4.tar.gz

Now by default vlc-git will use libfdk-aac (via FFmpeg) to produce all aac audio, producing very reasonable results according to my ears.

x264...

Now for x264, we will a install a local copy of the latest x264 which vlc will use for directly transcoding to h.264 (it does not use FFmpeg for this). The use of a local copy is to avoid the mire of dependencies and conflicting version requirements involved with a system installation under Ubuntu.

Installing x264:

if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--enable-pic"
 else
  ARCHOPTS=""
fi && \
cd $HOME/vlc_build && \
git clone git://git.videolan.org/x264.git --depth 1 && \
cd x264 && \
./configure --prefix=$HOME/vlc_build/vlcdeps/usr \
            --enable-static \
            --disable-cli \
            $ARCHOPTS && \
make && make install

Removing x264:

Removing the installed files is reasonably straightforward and the following syntax should be enough:

rm -v $HOME/vlc_build/vlcdeps/usr/include/x264* && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/libx264.a && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/pkgconfig/x264.pc

Updating x264:

x264 is updated fairly regularly so I would suggest returning here from time to time and updating the libraries as follows:

if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--enable-pic"
 else
  ARCHOPTS=""
fi && \
cd $HOME/vlc_build/x264 && git pull && \
./configure --prefix=$HOME/vlc_build/vlcdeps/usr \
            --enable-static \
            --disable-cli \
            $ARCHOPTS && \
make && make install

Note that these instructions do not actually create an x264 executable although it is a simple matter to do this as well...

x265...

Ubuntu's version of x265 will always be a little behind so we will install a newer version:

sudo apt-get -y remove x265 libx265-dev libx265-43 libx265-43-dbg libx265-doc && \
cd $HOME/vlc_build && \
wget https://bitbucket.org/multicoreware/x265/downloads/x265_1.7.tar.gz && \
tar xvf x265_1.7.tar.gz && \
cd x265_1.7 && \
mkdir -v build1 && cd build1 && \
cmake ../source && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes \
                  --pkgname x265 --pkgversion "1.7" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
sudo ldconfig && \
rm -rfv $HOME/vlc_build/multicoreware-x265-*/build1

x265 should be periodically updated and don't forget to recompile FFmpeg when you do so! A sample commandline is given here for experimentation, the gui seems to not work for this purpose:

cvlc -vv input.mp4 --sout \
         "#transcode{vcodec=hevc,scale=Auto,acodec=mp4a,ab=128,channels=2,samplerate=44100}:\
         std{access=file{no-overwrite},mux=mkv,dst='output.mkv'}" \
         vlc://quit

Interesting times ahead as x265 comes of age...

live555...

vlc uses live555 for reading some streams and the following single command sets up a local copy following alienBOB's (and the vlc contrib rules.mak) syntax very closely, this copy of live555 courtesy of the videolan servers.

Installing live555:

cd $HOME/vlc_build && sudo apt-get -y remove liblivemedia-dev && \
wget http://download.videolan.org/pub/contrib/live555/live.2014.07.25.tar.gz && \
tar xvf live.2014.07.25.tar.gz && chmod -R u+w live && cd live && \
if [ "$(uname -m)" = "x86_64" ]; then
  ./genMakefiles linux-64bit && make
else 
  ./genMakefiles linux && make
 fi && \
cp -v \
groupsock/libgroupsock.a liveMedia/libliveMedia.a UsageEnvironment/libUsageEnvironment.a \
BasicUsageEnvironment/libBasicUsageEnvironment.a $HOME/vlc_build/vlcdeps/usr/lib/ && \
cp -v \
groupsock/include/*.hh groupsock/include/*.h liveMedia/include/*.hh UsageEnvironment/include/*.hh \
BasicUsageEnvironment/include/*.hh $HOME/vlc_build/vlcdeps/usr/include/

Removing live555:

The following removes the installed live555 libraries, the expanded source and the original archived source:

rm -v $HOME/vlc_build/vlcdeps/usr/include/{*.hh,NetCommon.h} && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/{libgroupsock.a,libliveMedia.a,\
libUsageEnvironment.a,libBasicUsageEnvironment.a} && \
rm -rfv $HOME/vlc_build/live && \
rm -v $HOME/vlc_build/live.*.tar.gz

FFmpeg...

Next to install a local snapshot of a recent version of FFmpeg which will avoid disturbing system settings of either avconv or FFmpeg..

Installing FFmpeg:

sudo apt-get -y install libmp3lame-dev zlib1g-dev && \
cd $HOME/vlc_build && \
wget http://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2 && \
tar xvf ffmpeg-2.6.3.tar.bz2 && cd ffmpeg-2.6.3 && \
if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--enable-pic"
 else
  ARCHOPTS=""
fi && \
CPPFLAGS="-I$HOME/vlc_build/vlcdeps/usr/include" \
LDFLAGS="-L$HOME/vlc_build/vlcdeps/usr/lib" \
PKG_CONFIG_PATH="$HOME/vlc_build/vlcdeps/usr/lib/pkgconfig" \
./configure --prefix=$HOME/vlc_build/vlcdeps/usr \
            $ARCHOPTS \
            --enable-gpl \
            --enable-version3 \
            --enable-nonfree \
            --enable-libmp3lame \
            --enable-libvpx \
            --enable-libfdk-aac \
            --enable-libx265 \
            --disable-programs \
            --disable-doc \
            --disable-filters \
            --disable-avdevice \
            --disable-devices \
            --disable-avfilter \
            --disable-avresample && \
make -j 8 && make install-libs install-headers && make distclean

Removing FFmpeg:

To remove the installed libraries, the expanded source and the original archived source use the following:

rm -rfv $HOME/vlc_build/vlcdeps/usr/include/{libav*,libpostproc,libsw*} && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/{libav*.a,libpostproc.a,libsw*.a} && \
rm -v $HOME/vlc_build/vlcdeps/usr/lib/pkgconfig/{libav*.pc,libpostproc.pc,libsw*.pc} && \
rm -rfv $HOME/vlc_build/ffmpeg-*

DVD Playback...

Ubuntu will always lag with the required libraries for DVD playback so first to remove the repository versions:

sudo apt-get -y remove libdvdcss2 libdvdnav-dev libdvdnav4 libdvdread-dev libdvdread4

and then to compile and install the latest libraries:

libdvdcss

This library is needed for decryption of many DVDs and the following single command installs the latest version:

cd $HOME/vlc_build && \
wget http://download.videolan.org/pub/libdvdcss/1.3.99/libdvdcss-1.3.99.tar.bz2 && \
tar xvf libdvdcss-1.3.99.tar.bz2 && \
cd libdvdcss-1.3.99 && \
./configure --disable-doc \
            --docdir=/usr/share/doc/libdvdcss && make && \
mkdir -vp doc-pak && cp -v AUTHORS ChangeLog COPYING INSTALL NEWS README doc-pak && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes \
                  --pkgname libdvdcss2 --pkgversion "1.3.99" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean && sudo ldconfig

libdvdread

This library is needed for reading DVD video disks, the following single command installs the latest version:

cd $HOME/vlc_build && \
wget http://download.videolan.org/videolan/libdvdread/5.0.3/libdvdread-5.0.3.tar.bz2 && \
tar xvf libdvdread-5.0.3.tar.bz2 && \
cd libdvdread-5.0.3 && \
./configure && make && \
mkdir -vp doc-pak && cp -v AUTHORS ChangeLog COPYING NEWS README doc-pak && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes \
                  --pkgname libdvdread --pkgversion "5.0.3" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean && sudo ldconfig

libdvdnav

This library provides access to sophisticated DVD navigation including menus, the following single command installs the latest version:

cd $HOME/vlc_build && \
wget http://download.videolan.org/videolan/libdvdnav/5.0.3/libdvdnav-5.0.3.tar.bz2 && \
tar xvf libdvdnav-5.0.3.tar.bz2 && \
cd libdvdnav-5.0.3 && \
./configure  && make && \
mkdir -vp doc-pak && cp -v AUTHORS ChangeLog COPYING README TODO doc-pak && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes \
                  --pkgname libdvdnav --pkgversion "5.0.3" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean && sudo ldconfig

And now to come to grips the vlc source code:

Building vlc-git..

Finally we download the vlc-git source code and build it:

Install vlc-git:

cd $HOME/vlc_build && git clone git://git.videolan.org/vlc.git --depth 1 && \
cd $HOME/vlc_build/vlc && ./bootstrap && \
CPPFLAGS="-I$HOME/vlc_build/vlcdeps/usr/include" \
LDFLAGS="-L$HOME/vlc_build/vlcdeps/usr/lib" \
PKG_CONFIG_PATH="$HOME/vlc_build/vlcdeps/usr/lib/pkgconfig" \
./configure --prefix=/usr/local && \
make -j 8 && \
mkdir -vp doc-pak && cp -v AUTHORS COPYING INSTALL NEWS README THANKS doc-pak && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes --pkgname vlc \
                  --pkgversion "3.0.0-git~$(git rev-parse --short HEAD)" \
                  --fstrans=no --deldesc=yes --delspec=yes --default && \
make distclean && sudo ldconfig

And this should give you a working copy of vlc-git!

Updating vlc-git...

You should return from time to time to update your copy of vlc-git, the following single command will accomplish this:

cd $HOME/vlc_build/vlc && git pull && ./bootstrap && \
CPPFLAGS="-I$HOME/vlc_build/vlcdeps/usr/include" \
LDFLAGS="-L$HOME/vlc_build/vlcdeps/usr/lib" \
PKG_CONFIG_PATH="$HOME/vlc_build/vlcdeps/usr/lib/pkgconfig" \
./configure --prefix=/usr/local && \
make -j 8 && \
mkdir -vp doc-pak && cp -v AUTHORS COPYING INSTALL NEWS README THANKS doc-pak && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes --pkgname vlc \
                  --pkgversion "3.0.0-git~$(git rev-parse --short HEAD)" \
                  --fstrans=no --deldesc=yes --delspec=yes --default && \
make distclean && sudo ldconfig

This completes the setup of vlc-git for this guide and I wish you all the best with your continued exploration of the development version of this great media player!

Latest compile...

Latest successful compile is here:

andrew@corinth:~$ cvlc --version | head -n 2
VLC media player 3.0.0-git Vetinari (revision fb65835)
VLC version 3.0.0-git Vetinari (fb65835)
Compiled by andrew on corinth (May 21 2015 08:54:05)

I will test the installation from time to time and respond to updated libraries and any breakages, have fun with the latest and greatest vlc :).

And in conclusion...

I have had an incredible amount of fun compiling and running the latest development version of vlc under Ubuntu and I hope that you will also enjoy this process! If you have any queries about the material presented on this page please use the 'Support' link below which will take you to the Ubuntu Forums.