How do I convert an MP4 to an MP3?
I would recommend Sound Converter. It is extremely simple to use for what you want. You can find it in the Software Center, or install it from the terminal:
sudo apt-get install soundconverter
Ubuntu Repo: soundconverter
Apt Link: Install soundconverter
All you need to do is open it up, change your preferences (Edit -> Preferences) then click the "Add File" or "Add Folder" buttons to add the music to be converted, and click Convert. It doesn't get much simpler.
I have extracted the audio from mp4
and m4a
files and converted them to mp3
format many times; it is very useful when a lot of podcasts come in m4a
or mp4
format.
I found that the most reliable way to allow ffmpeg
to use proprietary formats was to build it from source, although you can see if it works with jfreak53's
method if you do not wish to build from source. (After uninstalling any ffmpeg
files, I compiled ffmpeg
from source using this guide)
In addition, the following script, which I have modified, (credit to the original creator), preserves the original name of the file in the newly converted file, which may be useful for you. Save it in a text editor and make it executable with chmod +x yourscriptname
.
#!/bin/bash
for f in *.mp4
do
name=`echo "$f" | sed -e "s/.mp4$//g"`
ffmpeg -i "$f" -vn -ar 44100 -ac 2 -ab 192k -f mp3 "$name.mp3"
done
In addition, following a suggestion by evilsoup, you could also use the following one-liner. It 'converts every MP4 in the current directory to an MP3', preserves the original name of the file, and 'to use it for an flv or avi or whatever, simply change both instances of mp4':
for f in *.mp4; do ffmpeg -i "$f" -vn -c:a libmp3lame -ar 44100 -ac 2 -ab 192k "${f/%mp4/mp3}"; done
If you mean export the audio from the video MP4 file then use ffmpeg, I do this all the time from FLV files. Firstly install ffmpeg:
sudo apt-get install ffmpeg libavcodec-unstripped-52
The run:
ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3
It might say that your missing some codecs for MP4, in that case just run:
aptitude search codecname
And find it to install.
By the way, you can get more information about this by searching the web. Here are a few useful resources, found in this way:
- Converting mp4 to mp3
- How can I convert MP4 video to MP3 audio with ffmpeg?
- Converting mp4 to mp3 in Ubuntu