Converting audio and video file formats in Linux

The gold standard of converting audio and video file formats in Linux is FFmpeg. It is a command-line tool capable of recording, converting and streaming audio and video. This article only covers audio and video file format conversion and show how easy it is to use. Installing FFmpeg Chances are that you already have FFmpeg installed on your system. Do the following to check to see, if it is installed.

$ which ffmpeg /usr/bin/ffmpeg

or

$ whereis ffmpeg ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1

If it isn't already installed, type the following if you have Ubuntu or another Debian system:

$ sudo apt-get install ffmpeg

or the following for Red Hat Family (RHEL, CentOS, Fedora)

$ yum install ffmpeg

or use the following commands if you prefer to install from source:

$ wget http://ffmpeg.org/releases/ffmpeg-0.6.1.tar.gz
$ tar xzvf ffmpeg-0.6.1.tar.gz
$ cd ffmpeg-0.6.1
$ ./configure
$ ./make
$ sudo make install

ffmpeg-0.6.1 is the latest stable version at the time of the writing of this article. You should see what is available at http://ffmpeg.org/download.html

Converting audio and video file formats with FFmpeg For simple conversion, simply do the following:

$ ffmpeg -i original_file.mpg converted_file.avi

This would convert the file with default parameters, 200kbps video and 64 kbps audio. This is low quality conversion. To maintain, file quality, use the -sameq option:

$ ffmpeg -i original_file.mpg -sameq converted_file.avi

There are many other options but most users are not interested in or understand the complex aspects and options for converting files. Most of us just want a small converted file we can post online or a conversion which maintains quality. If you need more power:

$ man ffmpeg
Technologies: