How to Extract MP3 Audio File from Video in Linux [Graphical & Command]

Got a Music Video (MV) or movie file and want to extract audio from it? It’s easy to do it in Linux using either single command or a graphical tool.

Extract MP3 from Video via FFmpeg command

FFmpeg is a command line toolbox to process multimedia content such as audio, video, subtitles and related metadata. As a widely used media library, it’s usually exist in your system. If not, run command below to install it:

  • For Debian, Ubuntu, Linux Mint based systems, run command:
    sudo apt install ffmpeg
  • For Fedora based systems, run command:
    sudo dnf install ffmpeg

And to extract audio using FFmpeg, firstly open terminal from system application launcher. Secondly, you may need to run cd command to navigate to the folder, Videos folder for instance, that contains the video files.

cd Videos

Finally, run single command to extract MP3 from a video file:

ffmpeg -i input.avi -q:a 0 -map a output.mp3
Here changes the "input.avi" to the video file name, and replace "output.mp3" with your desired name.
For instance, I'm going to extract the SayGoodbye.mkv file. The command could be:

ffmpeg -i SayGoodbye.mkv -q:a 0 -map a SayGoodbye.mp3

The flag -i specifies the input file. And -q:a is used to control the audio quality. While value 0 is set to the highest quality, you can set number from 0 to 9. See the table:

FFmpeg option Average kbit/s Bitrate range kbit/s
-q:a 0 245 220-260
-q:a 1 225 190-250
-q:a 2 190 170-210
-q:a 3 175 150-195
-q:a 4 (default) 165 140-185
-q:a 5 130 120-150
-q:a 6 115 100-130
-q:a 7 100 80-120
-q:a 8 85 70-105
-q:a 9 65 45-85

If you need constant bitrate (CBR) MP3 audio, replace -q:a with -b:a. For instance, -b:a 256k if you want 256Kb/s (25.6 KB/s) audio. The value can be: 8k, 16k, 24k, 32k, 40k, 48k, 64k, 80k, 96k, 112k, 128k, 160k, 192k, 224k, 256k, or 320k.

And the -map flag tells that which streams from input file should be included in output. And value a means audio. 

Extract MP3 from Video via SoundConverter App:

Compare to Linux command, using a graphical tool will be more straightforward. All video editors have ability to extract audio streams, they are however heavy and not easy for beginners.

Here I’m going to use SoundConverter, or SoundKonverter for KDE. It’s a small sound converting apps that available in most Linux systems, including Ubuntu, Fedora, Debian, OpenSUSE, FreeBSD, and more. And it supports batch file processing!

If you don’t have it. Install it either from system package manager or by running command in terminal:

  • For Debian, Ubuntu, Linux Mint based systems run command:
    sudo apt install soundconverter
  • For Fedora based systems, run command:
    sudo dnf install soundconverter

Once installed, launch the tool, click on header bar button to open video files or folders. Set output format, mp3 in the case, by clicking on the gear button. And finally click “Convert”. Just so easy!

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.