3

I have worked on multiple tools that convert a "mp4" file to "mp3" format, but what I am really interested in, is there a way I can convert multiple mp4 files to mp3 format in a single go.

6
  • 1
    What Ubuntu applications have you tried and what problems did you encounter? Please add these details to your question if you could. Mar 17, 2013 at 10:47
  • 2
    if you can do 1 in command line you are 1 for/next loop away from doing multiple ;)
    – Rinzwind
    Mar 17, 2013 at 10:48
  • @maggotbrain:i used WinFF but didn't work, it generates an error on terminal and says press enter to cont. Mar 17, 2013 at 10:51
  • @Rinzwind: Sir as far as i know all mp4 files ll be having different names so how will the loop work .can u please five an exmple Mar 17, 2013 at 10:53
  • WinFF needs to be updated and it appears to have some conflicting settings that when converting force conversion to stop. Mar 18, 2013 at 5:25

6 Answers 6

3

Sound Converter can convert Videos to Audio, and allows multiple files. It is the best program I have found to convert anything audio wise. It is installable from the Ubuntu software center.

When you run the program make sure to change your preferences, under the edit drop down menu, to what format you want to convert as well as many other settings.

Here is an example of converting a video into audio (MP4 to MP3) as you have requested.

enter image description here

3
  • I have worked on this also but the problem is I need the output in .mp3 format no .wav format as it shows only .wav in preferences Mar 17, 2013 at 10:55
  • No there is an option to output to .mp3 That is how I convert all my audio files. Under preferences select the output file type to mp3. I just attempted it and it works fine for me. Mar 18, 2013 at 5:23
  • See my edit please. It clearly shows you can convert mp4 to mp3 Mar 18, 2013 at 5:32
2

A Nautilus Script Solution

#!/bin/sh
#Nautilus Script to convert selected MP4/M4A file(s) to MP3 format at highest quality using Variable Bit Rate
IFS_BAK=$IFS
IFS="
"
for filename in $@; do
file_name_in=$(basename "$filename")
file_name_out="$(basename "$filename" | sed 's/\.[^.]*$//').mp3"
file_to="$(echo "$filename" | sed 's/\.[^.]*$//').mp3"
(ffmpeg -loglevel quiet -y -i "$file_name_in" -acodec libmp3lame -aq 0 "$file_name_out") 2>&1 | zenity --progress --title "Converting..." --text "<b>From:</b><i> $filename </i>\n\n<b>To:</b><i> $file_to </i>\n" --pulsate --auto-close
done
fi
IFS=$IFS_BAK
  1. Make sure that you have ffmpeg and libmp3lame installed.

  2. Copy and paste the text block above in your text editor, save this new file in the Nautilus Scripts folder (e.g. ~/.local/share/nautilus/scripts) giving it a name like Convert MP4 to MP3, and make it executable.

  3. In Nautilus file manager, select the MP4 file(s) to be converted, right click, choose Scripts and then Convert MP4 to MP3.

You should get new MP3 files side by side with MP4 files shortly.

1

I have just converted six .mp4 to .mp3 using Winff 1.4.1 in Ubuntu 12.04, and it has worked smoothly.

The terminal window that opens up doesn't show errors but the conversion process and it will only tell you to 'Press enter to continue' after it's completed. Check the folder you chose as your 'output folder' for the mp3's.

Check screenshots below:

  1. Choose your files and select your options and click convert: enter image description here

  2. A terminal window opens up to show you the conversion process (mine is semi-transparent): enter image description here

  3. After completion, that's when you get the 'Press enter to continue' text: enter image description here

  4. Finally, navigate to your folder and get your mp3 converted files: enter image description here

0

Install "Format Junkie". This can satisfies all of your audio and video conversion needs.

sudo add-apt-repository ppa:hakermania/format-junkie
sudo apt-get update
sudo apt-get install formatjunkie
0

This is my command-line version: mencoder is required, so if is not installed, run:

sudo atp install mencoder

then, extract the audio in mp3 format with the command:

mencoder sample_video_in.mp4 -of rawaudio -oac mp3lame -ovc copy -o sample_audio_out.mp3

this command may be insert in a loop script.

mencoder has a lot of options, see man mencoder for more help

0

One way is to use avconv and a for loop. First make sure you have avconv installed as well as a suitable encoder:

sudo apt-get install libav-tools libavcodec-extra-53

Then navigate to the location of your mp4 files and run the following:

for f in *.mp4
  do 
  avconv -i "$f" -vn -c:a libmp3lame -qscale:a 2 "${f%.mp4}.mp3"
done

And this should get your mp3s stripped from the mp4 files. Mind you if the mp4s already have an mp3 audio stream you would be better to simply copy the stream...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .