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.

BuZZ-dEE
  • 14,533

6 Answers6

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

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.

Sadi
  • 11,074
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

Parto
  • 15,647
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

girardengo
  • 5,005
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...

andrew.46
  • 39,359