FFmpeg 2.8.1 Multimedia Framework Released – Installation Guide and Usage – Part 1
A new major release (2.8.1) of the FFmpeg multimedia framework is now available for download, bringing a few fixes and updates for different packages.
FFmpeg 2.8.1 which is named “Feynman” does not include any additional feature, but changes from ffmpeg-mt, libav master of 2015-08-28, libav 11 as of 2015-08-28. The following library versions are also available in this minor release.
- libavutil 54. 31.100
- libavcodec 56. 60.100
- libavformat 56. 40.101
- libavdevice 56. 4.100
- libavfilter 5. 40.101
- libavresample 2. 1. 0
- libswscale 3. 1.101
- libswresample 1. 2.101
- libpostproc 53. 3.100
This maintenance build is part of the 2.8 release branch which is a major release with many new features and bug fixes that was made available on 2015-09-05 of this year.
A very important feature present in FFmpeg 2.8.1, I would like to notice in this article is the WebP encoding via libwebp.
What is WebP?
WebP is a new open source image format which is very useful to web developers that want to create very fast websites. Lossy WebP compression is used to get smaller new images in output from the original ones. According to the official description of the WebP image format in the google’s developers site, WebP images are way too small in size compared to their png versions.
There are also many other available features in FFmpeg 2.8.1 such as HNM version 4 demuxer, libx265 encoder, Live HDS muxer, DNx444 support, ATRAC3+ decoder, Mirillis FIC video decoder and many others that you can find in the news section on ffmpeg.org.
The main priority of this article series is not to count features, but to teach the user how to install and use the FFmpeg framework in their Linux machines in order to perform some basic operations such as convert multimedia files between formats, play audio/video files, record audio/video files and how to encode or decode them.
The first thing you should do before learning how to use the FFmpeg tools is to learn what is FFmpeg. So, what is it?
What is FFmpeg
FFmpeg is one of the best multimedia frameworks that contains various tools for different tasks. For example the ffplay is a portable media player that can be used to play audio/video files, ffmpeg can convert between different file formats, ffserver can be used to stream live broadcasts and ffprobe is able to analyse multimedia stream.
This framework is really powerful due to the diversity of available tools in it, that provide the best technical solution for the user. According to the description of FFmpeg in the official website, the reason for having such a great multimedia framework is the combination of the best free software options available.
The FFmpeg framework offers high security and the reason for this is the seriosity of the developers when they review the code, it is always done with security in mind.
I am very sure you will find this framework very useful when you would like to do some digital audio and video streaming or recording. There are many other practical thing that you can do with the help of the FFmpeg framework such as converting your wav file to an mp3 one, encode and decode your videos or even scale them.
According to the official website FFmpeg is able to do the followings.
- decode multimedia files
- encode multimedia files
- transcode multimedia files
- mux multimedia files
- demux multimedia files
- stream multimedia files
- filter multimedia files
- play multimedia files
Let me take an example, a very simple one. The following command will convert your mp4 file into an avi file, simple as that.
# ffmpeg -i Lone_Ranger.mp4 Lone_Ranger.avi
The above command is only useful for explanation, it is not recommended to be used in practice because the codex, bitrate and other specifics are not declared.
In the next part we will practice with some of the FFmpeg multimedia framework tools, but before doing that we have to install it in our Linux box.
How to Install FFmpeg Multimedia Framework in Linux
Since the FFmpeg packages are offered for the most used Linux distributions and the installation will be relatively easy. Lets start with the installation of the FFmpeg framework in Ubuntu based distributions.
On Debian, Ubuntu and Linux Mint
I will install FFmpeg via the PPA recommended in the official blog. Open a new terminal (CTRL+ALT+T) and then run the following commands.
$ sudo add-apt-repository ppa:jon-severinsson/ffmpeg $ sudo apt-get update $ sudo apt-get install ffmpeg
FFmpeg Compiling from Source
Compiling software from source is not the easiest thing in the world, but with the right instructions we will be able to do it. First make sure your system meet all the dependencies. The installation of these dependencies can be done with the help of the following commands.
First, tell the system to pull down the latest packages.
$ sudo apt-get update
Install the dependencies with the following command.
$ sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \ libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \ libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
Then use the following command to create a new directory for the FFmpeg sources. This is the directory where the source files will be downloaded.
$ mkdir ~/ffmpeg_sources
Now compile and install yasm assembler used by FFmpeg by running the following commands.
$ cd ~/ffmpeg_sources $ wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz $ tar xzvf yasm-1.3.0.tar.gz $ cd yasm-1.3.0 $ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" $ make $ make install $ make distclean $ export "PATH=$PATH:$HOME/bin"
After you have successfully installed the yasm assembler it is time to install some various encoders that will be used with the specific FFmpeg tools. Use the following commands to install the H.264 video encoder.
$ cd ~/ffmpeg_sources $ wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 $ tar xjvf last_x264.tar.bz2 $ cd x264-snapshot* $ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static $ make $ make install $ make distclean
Another nice useful encoder is the libfdk-aac AAC audio encoder.
$ cd ~/ffmpeg_sources $ 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 $ make distclean
Install libopus audio decoder and encoder.
$ cd ~/ffmpeg_sources $ wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz $ tar xzvf opus-1.1.tar.gz $ cd opus-1.1 $ ./configure --prefix="$HOME/ffmpeg_build" --disable-shared $ make $ make install $ make distclean
Now, it’s time to install ffmpeg from source.
$ cd ~/ffmpeg_sources $ wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 $ tar xjvf ffmpeg-snapshot.tar.bz2 $ cd ffmpeg $ PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" $ export PKG_CONFIG_PATH $ ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl \ --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus \ --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab $ make $ make install $ make distclean $ hash -r
Note: If you have not installed certain encoders, make sure to remove ‘–enable-encoder_name‘ from the above ‘./configure‘ command so the installation is done without any problem.
On RHEL, CentOS and Fedora
To make everything simple for everyone we are not going to compile FFmpeg from source this time, but we will enable RPMForge Repository to install with all necessary packages.
# yum install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig SDL-devel \ a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel freetype-devel giflib gsm gsm-devel \ imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel libXau-devel libXdmcp-devel \ libXext-devel libXrandr-devel libXrender-devel libXt-devel libogg libvorbis vorbis-tools mesa-libGL-devel \ mesa-libGLU-devel xorg-x11-proto-devel zlib-devel libtheora theora-tools ncurses-devel libdc1394 libdc1394-devel \ amrnb-devel amrwb-devel opencore-amr-devel
Next, install ffmpeg packages.
# yum install ffmpeg ffmpeg-devel
There are many encoders that you can install, but fur the purpose of this article I am not going to install all of them, but you can install them using the following official guides.
In this first part we updated our readers with the latest news according to the FFmpeg multimedia framework and showed them how to install it in their Linux machines. The next part will be totally about learning how to use the amazing tools inside this leading multimedia framework.
Update: The Part 2 of this FFmpeg series is published, which shows some useful ffmpeg commandline usage to perform various audio, video and image conversion procedures.