Install ffmepg on Ubuntu Server
Introduction
FFmpeg is a powerful open-source multimedia framework used to record, convert, stream, and process audio and video files. It supports a wide range of codecs and formats, making it a popular choice for media transcoding, video editing, streaming, and automation tasks. This guide explains how to install FFmpeg from source on an Ubuntu server along with the required codec libraries to enable comprehensive multimedia support.
Prerequisites
Before proceeding with the installation, ensure the following requirements are met:
- An Ubuntu server with sudo or root privileges.
- A stable internet connection to download the required packages and source files.
- The system package repository is updated.
- Basic knowledge of Linux command-line operations.
- Sufficient disk space for downloading, compiling, and installing the source packages.
IMPLEMENTATION
This post guides you to install ffmpeg on Ubuntuthe the the the anrepos server.
Let’s update all the repo’s on the host.
apt-get update
Install the required package using apt-get install.
apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev yasm libx264-dev unzip libopus-dev libmp3lame-dev
Create a ffmpeg installation directory.
mkdir /usr/local/src/ffmpeg cd /usr/local/src/ffmpeg
Download and install.
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master unzip fdk-aac.zip cd mstorsjo-fdk-aac* autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install
Install libpvx package.
wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2 tar xjvf libvpx-v1.3.0.tar.bz2 cd libvpx-v1.3.0 PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples PATH="$HOME/bin:$PATH" make make install
Install libogg package.
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="$HOME/ffmpeg_build" --disable-shared make make install
Install ffmpeg package.
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" --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-nonfree PATH="$HOME/bin:$PATH" make make install
Copy the binary to executable path
cp /usr/local/src/ffmpeg /usr/sbin
Conclusion
FFmpeg has now been successfully installed on your Ubuntu server with support for multiple audio and video codecs. Installing from source ensures you have access to the latest features and greater codec compatibility compared to the default repository packages. To confirm the installation, run the following command:
ffmpeg -version
If the version information is displayed without errors, the installation is complete and FFmpeg is ready to be used for media conversion, encoding, decoding, streaming, and other multimedia processing tasks.
