How can I convert audio from MP4 or FLV video files to mp3?
Solution 1
You can do the same in 12.04 by using several software.
Using WinFF
-
Install winff and libavcodec-extra first
sudo apt-get install winff libavcodec-extra
-
Open Winff from dash
-
Then in Winff window, do these
Add file
Select what catagory to convert (select Audio)
Select Audio file format (mp3)
Type the output folder for converted file
- Then click the Convert button. You can also click Options button to file tune the audio format and other options.
Using VLC
-
Install VLC and "libavcodec-extra" package first
sudo apt-get install vlc libavcodec-extra
-
Open VLC from dash by pressing
Super
key and typing "VLC" there -
Then from top panel menu, Select Media → Convert/Save.
-
Then Add file to convert in the new window. Then click Convert button.
-
In the new window, Select the directory for output file, select the conversion profile (Audio mp3) and click Start button.
Using command line
-
First install the tools
sudo apt-get install ffmpeg libavcodec-extra libav-tools
If you are using
-
Use this simple command to extract the audio file
avconv -i /input-file-name-with-path output-filename.mp3
For example to convert the "How fast.ogg" video file into
how-fast.mp3
use this command:avconv -i /usr/share/example-content/Ubuntu_Free_Culture_Showcase/How\ fast.ogg how-fast.mp3
See the manual page for more options and information.
To Just extract audio
Check these answer
Solution 2
you can do it using ffmpeg. Install ffmpeg using following command:
sudo apt-get install ffmpeg libavcodec-unstripped-52
The package libavcodec-unstripped-52 is available in Multiverse repo, so you will need to enable it.
After installing these packages, you can use a command like the one below to extract the audio as mp3:
ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3
The -i option in the above command is simple: it is the path to the input file. The second option -f mp3 tells ffmpeg that the ouput is in mp3 format. The third option i.e -ab 192000 tells ffmpeg that we want the output to be encoded at 192Kbps and -vn tells ffmpeg that we dont want video. The last param is the name of the output file.
Solution 3
soundconverter is another tool that can convert audio formats and also video to audio only:
or via the terminal:
sudo apt-get install soundconverter
Solution 4
It is very easy to do with WinFF (install it), which is a GUI for ffmpeg.
- Click add.
- Select a video file
- In Convert to, select Audio
- Select an audio codec
- Click Convert. (Notice that the Convert button might sometimes disappear if the window is too small. Make the window larger if you don't see it)
Done. Screenshot:
Solution 5
soundconverter is another tool that can convert audio formats and also video to audio only.
It can be installed in the Software Center (by clicking the above link) or by running these commands in a Terminal (Ctrl+Alt+T):
sudo apt-get update
sudo apt-get install soundconverter
Related videos on Youtube
b-ak
Updated on September 18, 2022Comments
-
b-ak over 1 year
Is there an application that allows me to extract the audio from a MP4 or FLV video file and store it as an MP3 file for use in a portable media player?
-
b-ak over 12 yearsI did some more searching on ffmpeg, I found this wonderful guide catswhocode.com/blog/19-ffmpeg-commands-for-all-needs
-
Tojamismis about 12 yearsThanks for the tip. I have been using VLC for a while but I didn't know of this feature
-
arielf almost 12 yearsI prefer the newer audio/video converter avconv. syntax is similar to ffmpeg: 'avconv -i input.mp4 -vn -qscale 1 output.mp3' ... -qscale 1 ensures maximum quality (and VBR) and the type of the encoder is deduced from the output file extension.
-
Arpad Horvath over 11 yearsI think in the command line the libavcodec-extra-53 package is important. Before I installed it, I do not succeded to convert to mp3.
-
Anwar over 11 years@ArpaD wasn't that i said in the answer?
-
Arpad Horvath over 11 yearsSorry. I have not thought that it seems from my comment, that everything is bad in your description. I was just happy to realize, that with that package it is so easy from the command line. I will moderate myself.
-
Anwar over 11 years@ArpaD no problem. I was confused with your comment. Thanks. I know now, it was verifying my answer
-
Paweł Łabaj over 11 yearshave you tested converting flv to mp3 in soundconverter? while converting mp4 video to mp3 works ok, in my case it works endlessly with no result to a flv file that winff converts in seconds
-
IcyFlame about 11 yearsamazing nswer...!! so detailed and clear... thanks a lot... this really took me out from a big fix!!
-
Mittenchops over 10 yearsffmpeg now comes from libav-tools.
-
melmi over 10 yearsRunning this program, it says: *** THIS PROGRAM IS DEPRECATED *** This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
-
kevinarpe over 10 yearsOutstanding answer. Nice work.
-
j0h over 9 yearsIn older versions, of ubuntu, you can use sudo apt-get install winff libavcodec-extra-52 I also want to note, that winff can run from the command line, and for me, required root permissions to do the conversions.
-
Vineet Kaushik about 9 yearsThis doesn't work now...
sudo apt-get install winff libavcodec-extra53
gives the following output: Package libavcodec-extra-53 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: libav-tools:i386 libav-tools E: Package 'libavcodec-extra-53' has no installation candidate -
Hitechcomputergeek almost 9 yearsNow I think it's 56. But why not just install the
libavcodec-extra
metapackage? -
ttoine almost 9 yearsthis answer is great, it just misses Sound Converter, imho the most easy way to do it !
-
kelin about 8 yearsNice answer, because ffmpeg can be used on mac os, and I don't need to switch to ubuntu :)
-
wordsforthewise almost 8 yearsI had to do sudo apt-get install ubuntu-restricted-extras to enable conversion to mp3s
-
wordsforthewise almost 8 yearsalso install ubuntu-restricted-extras for mp3 conversion
-
HighCommander4 over 7 years+1 for
avconv
. I've been looking for a simple command-line way to do this for a long time! -
Arpad Horvath about 7 years@M.Elmi ffmpeg is not deprecated if this answer is true: stackoverflow.com/a/9477756/813946
-
augusto over 4 yearsWeird how the new mp3 file is even larger than source video:
a@a-Inspiron-660 ~/Video $ ll _-M8J8urC_8Jw.mkv music.mp3 -rw-rw-r-- 1 a a 26844523 gen 23 2019 _-M8J8urC_8Jw.mkv -rw-rw-r-- 1 a a 31069582 ott 26 12:02 music.mp3 a@a-Inspiron-660 ~/Video $