ogg to mp3

Share your how-tos and guides with other users

Moderators: ChrisThornett, LXF moderators

ogg to mp3

Postby heiowge » Mon Dec 26, 2011 11:58 pm

My mp3 player doesn't see ogg files.

Is there an easy to use program that can bulk convert 100+ ogg files at a time to mp3?

ta
i5 4440 3.1Ghz, Asus H87M-E motherboard, 8GB DDR3, 2GB DDR5 nVidia card, 2x500GB Seagate hd, Coolermaster 750W PSU running Mint 16 MATE and Win7

eeepc 1015PX, 1.66 Ghz Intel atom processor, 2 GB DDR3, 320 GB hd, Mint 14 MATE. Fan needs fixing.
User avatar
heiowge
LXF regular
 
Posts: 1905
Joined: Wed Feb 27, 2008 8:21 pm
Location: Cheshire, UK

Postby Rhakios » Tue Dec 27, 2011 1:45 am

It's never a particularly good idea to re-encode compressed files, but if you must then SoundConverter (or SoundKonverter for KDE users) can do the job on a file or folder basis. How long it takes will depend on how fast your computer is.
Cue someone with a way to do it from the command line...
Bye, Rhakios
User avatar
Rhakios
Moderator
 
Posts: 7634
Joined: Wed Apr 06, 2005 11:18 pm
Location: Midlands, UK

Postby PCNetSpec » Tue Dec 27, 2011 5:26 am

Code: Select all
cd /directory/containing/ogg/files

then
Code: Select all
for name in *.ogg; do ffmpeg -i "$name" "$(basename "$name" .ogg).mp3"; done


ffmpeg defaults to a bitrate of 64k .. so if you want a higher bitrate (say 128k), make that:

Code: Select all
for name in *.ogg; do ffmpeg -i "$name" -ab 128k "$(basename "$name" .ogg).mp3"; done
WARNING: You are logged into reality as 'root'... logging in as 'insane' is the only safe option.
Linux in the UK
The Linux Community Forum
User avatar
PCNetSpec
LXF regular
 
Posts: 631
Joined: Sun Feb 21, 2010 3:50 pm
Location: Cornwall UK

Postby nelz » Tue Dec 27, 2011 10:45 am

No need to use basename, shells can do the extension replacement themselves

Code: Select all
"${name/.ogg/.mp3}"


which also avoids the problem of the unbalanced, nested quoted, which really need to be escaped. You also have the probem of ffmpeg losing all the ID data. Sound[CK]onverter is probably the best option.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8496
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby PCNetSpec » Tue Dec 27, 2011 2:42 pm

Nice :)

How about:

Code: Select all
for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_meta_data 0:0,s0 "${name/.ogg/.mp3}"; done;


which seems to keep the metadata.
WARNING: You are logged into reality as 'root'... logging in as 'insane' is the only safe option.
Linux in the UK
The Linux Community Forum
User avatar
PCNetSpec
LXF regular
 
Posts: 631
Joined: Sun Feb 21, 2010 3:50 pm
Location: Cornwall UK

Postby nelz » Tue Dec 27, 2011 3:33 pm

That should do it, I hadn't see the map_metadata option before.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8496
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby Ram » Wed Dec 28, 2011 11:40 am

Think this should be moved to the Tips section...

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1676
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough


Return to Hints and tips

Who is online

Users browsing this forum: No registered users and 0 guests