Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ogg to mp3

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Hints and tips
View previous topic :: View next topic  
Author Message
heiowge
LXF regular


Joined: Wed Feb 27, 2008 8:21 pm
Posts: 1901
Location: Cheshire, UK

PostPosted: Mon Dec 26, 2011 11:58 pm    Post subject: ogg to mp3 Reply with quote

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.
Back to top
View user's profile Send private message
Rhakios
Moderator


Joined: Thu Apr 07, 2005 12:18 am
Posts: 7628
Location: Midlands, UK

PostPosted: Tue Dec 27, 2011 1:45 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
PCNetSpec
LXF regular


Joined: Sun Feb 21, 2010 3:50 pm
Posts: 631
Location: Cornwall UK

PostPosted: Tue Dec 27, 2011 5:26 am    Post subject: Reply with quote

Code:
cd /directory/containing/ogg/files

then
Code:
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:
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
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8457
Location: Warrington, UK

PostPosted: Tue Dec 27, 2011 10:45 am    Post subject: Reply with quote

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

Code:
"${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)
Back to top
View user's profile Send private message
PCNetSpec
LXF regular


Joined: Sun Feb 21, 2010 3:50 pm
Posts: 631
Location: Cornwall UK

PostPosted: Tue Dec 27, 2011 2:42 pm    Post subject: Reply with quote

Nice Smile

How about:

Code:
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
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8457
Location: Warrington, UK

PostPosted: Tue Dec 27, 2011 3:33 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
Ram
LXF regular


Joined: Thu Apr 07, 2005 10:44 pm
Posts: 1670
Location: Guisborough

PostPosted: Wed Dec 28, 2011 11:40 am    Post subject: Reply with quote

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.....
Back to top
View user's profile Send private message MSN Messenger
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Hints and tips All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast