83

I'm looking for a well working audio converter which is able to convert audio files (ogg) to mp3 format. I tried it with the "sound converter" from the software center but it stopped converting after 6 of 12 files.

0

5 Answers 5

141

I use ffmpeg for sound conversion:

ffmpeg -i file.ogg file.mp3
ffmpeg -i file.{ogg,mp3}      # if only the extension changes

If your filename contains spaces, don’t forget to quote it, e.g.:

ffmpeg -i "file with spaces".{ogg,mp3}

To perform batch processing, you can either use a for loop like

for i in *.ogg; do ffmpeg -i "$i" "${i%.*}.mp3"; done

or – especially for many and/or large files! – GNU parallel:

parallel ffmpeg -i "{}" "{.}.mp3" ::: *.ogg

This last command will convert every .ogg file in the current directory to .mp3 efficiently using your CPU(s) to perform multiple tasks in parallel.

To set the audio bitrate, ffmpeg provides the -b:a BITRATE option, e.g. -b:a 192k. If you want to include metadata like title, album and so on, you can use these options:

-map_metadata 0:s:0 -id3v2_version 3 -write_id3v1 1

See man ffmpeg and this linuxforums.org.uk post for further information.

1
11

You can try ogg2mp3.

You can install ogg2mp3 in Ubuntu 12.04 or 13.10 by first getting the debian package file from this ogg2mp3 download page.

Open the .deb file using the Software Center, it will install it for you.

Batch conversion

First put all the files that you want convert into a single folder (let’s call it ogg_src). Then simply give ogg2mp3 the folder path with the appropriate audio parameters (bitrate, channels etc) and it will automatically convert one by one, open a terminal and type:

ogg2mp3 /home/me/ogg_src/ -a 96

For more information please read its manual (including the actual converting tool called lame by using the below commands:

man ogg2mp3
man lame

Source

8

SoundConverter, which makes use of GUI(Gnome), but can also be used from the command line. Supported Formats Mp3, OGG, AAC, WAV, Flac

Install:

sudo apt-get install soundconverter

Convert:

soundconverter -b -m "mp3" -s ".mp3" /home/za/Music/blackmill.ogg
  • b, --batch Convert in batch mode, from command line, without a graphical user interface.
  • m, --mime-type Set the output MIME type for batch mode. The default is audio/x-vorbis.
  • s, --suffix Set the output filename suffix for batch mode. The default is .ogg.
5

I use WinFF which is a fast AV converter, and it has a friendly interface. Very easy to use once you familiarize yourself with the presets that come together with this app. If you're interested in audio file coversion only, you can use WinFF's audio presets, and convert multiple files at once with great speed and best quality.

You can install WinFF from the Software Center, or with Synaptic or you can use the link provided above to install the latest stable version. You need to install prior to installing WinFF the following packages: ffmpeg and libavcodec-extra-53 or libavcodec53.

4

Here's the script i use to convert ogg to mp3 with id3 tags.

Save this text below to a file called ogg2mp3. Make it executable with chmod +x ogg2mp3.

Execute in terminal and pass one parameter, which is the path to a folder.

(you need ffmpeg obviously, and zenity package for notifications)

#!/bin/bash
#

kbps=320

crtpath=$PWD
cd "$1"

old_IFS=${IFS}
IFS='
'

files=$(find . -type f -regex '^.+\.ogg$' | sort)

declare -i nn=0
for file in ${files}
do
  fn=$(readlink -f "$file")

  dest=$(echo "$fn"|sed -e 's/\.ogg$/\.mp3/')

  ffmpeg -i "$fn" -ab ${kbps}k -map_metadata 0:s:0 "${dest}"

  let nn=nn+1
done

cd "${crtpath}"
zenity --info --text "Finished converting ogg to mp3.${IFS}Processed ${nn} files."
#notify-send -i info Information "Finished converting ogg to mp3.${IFS}Processed ${nn} files."

IFS=${old_IFS}
0

You must log in to answer this question.

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