The ffmpeg software is a free and open source suite of utilities that facilitate audio and video media. On Linux systems, installing ffmpeg gives us access to the ffmpeg command, which can be used to convert audio files to various types, such as wav, mp3, ogg, etc.

In this guide, we will go over the instructions to install ffmpeg on major Linux distros. Then, you'll see various command line examples that can be used to convert between different audio formats. Use the examples below to convert your own files.

In this tutorial you will learn:
  • How to install ffmpeg on major Linux distros
  • How to use ffmpeg in audio conversion examples
Converting between audio formats using the ffmpeg command on Linux
Converting between audio formats using the ffmpeg command on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software ffmpeg
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Install ffmpeg on major Linux distros


SUBSCRIBE TO NEWSLETTER
Subscribe to our NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


Before we dive into the conversion examples below, you'll need to install ffmpeg on your system. The software is available on all major Linux distros and can be easily installed using your system's package manager. Use the appropriate command below to install it on your own computer.

To install ffmpeg on Ubuntu, Debian, and Linux Mint:

$ sudo apt install ffmpeg

To install ffmpeg on Fedora:

$ sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
$ sudo dnf install ffmpeg

To install ffmpeg on CentOS, AlmaLinux, and Red Hat:

$ sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
$ sudo dnf install ffmpeg

To install ffmpeg on Arch Linux and Manjaro:

$ sudo pacman -S ffmpeg

Audio conversion examples

Check out some of the audio conversion examples below to see how ffmpeg can convert your files to different formats. We've compiled some of the most common options here. Note that ffmpeg has many additional quality settings and other options. It's recommended to check out the man page and include the necessary flags in your commands.

WAV - Waveform Audio File Format

wav to mp3

Convert wav to mp3 with ffmpeg:



$ ffmpeg -i audio.wav -acodec libmp3lame audio.mp3

wav to ogg

Convert wav to ogg with ffmpeg:

$ ffmpeg -i audio.wav -acodec libvorbis audio.ogg

wav to aac

Convert wav to acc with ffmpeg:

$ ffmpeg -i audio.wav  -acodec libfaac audio.aac

wav to ac3

Convert wav to ac3 with ffmpeg:

$ ffmpeg -i audio.wav -acodec ac3 audio.mp3

OGG - Free, open standard container

ogg to mp3

Convert ogg to mp3 with ffmpeg:

$ ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3

ogg to wav

Convert ogg to wav with ffmpeg:

$ ffmpeg -i audio.ogg audio.wav

ogg to aac

Convert ogg to aac with ffmpeg:

$ ffmpeg -i audio.ogg  -acodec libfaac audio.aac

ogg to ac3

Convert ogg to ac3 with ffmpeg:

$ ffmpeg -i audio.ogg -acodec ac3 audio.ac3

AC3 - Acoustic Coder 3



ac3 to mp3

Convert ac3 to mp3 with ffmpeg:

$ ffmpeg -i audio.ac3 -acodec libmp3lame audio.mp3

ac3 to wav

Convert ac3 to wav with ffmpeg:

$ ffmpeg -i audio.ac3 audio.wav

ac3 to aac

Convert ac3 to aac with ffmpeg:

$ ffmpeg -i audio.ac3 -acodec libfaac audio.aac

ac3 to ogg

Convert ac3 to ogg with ffmpeg:

$ ffmpeg -i audio.ac3 -acodec libvorbis audio.ogg

AAC - Advanced Audio Coding

aac to mp3

Convert aac to mp3 with ffmpeg:

$ ffmpeg -i audio.aac -acodec libmp3lame audio.mp3

aac to wav

Convert aac to wav with ffmpeg:

$ ffmpeg -i audio.aac audio.wav

aac to ac3

Convert aac to ac3 with ffmpeg:

$ ffmpeg -i audio.aac -acodec ac3 audio.ac3

aac to ogg

Convert aac to ogg with ffmpeg:

$ ffmpeg -i audio.aac -libvorbis audio.ogg

SUBSCRIBE TO NEWSLETTER
Subscribe to our NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


Closing Thoughts

In this guide, we saw how to install the ffmpeg suite on major Linux distros, then use the ffmpeg command to convert audio files between different formats. Our examples contained some of the most common formats, but many more exist, and the ffmpeg software is packed with options. You can adapt our examples to your own needs, while customizing your commands with further options found in the ffmpeg man pages.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.