Author Topic: Batch converting .ogg to .mp3 keeping the ID tag metadata  (Read 29956 times)

0 Members and 1 Guest are viewing this topic.

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 17670
  • Karma: 457
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Batch converting .ogg to .mp3 keeping the ID tag metadata
« on: December 29, 2011, 09:42:23 pm »
CLI method  .. For command line junkies.

"cd" to the directory containing your .ogg files:
Code: [Select]
cd /path/to/directory/containing/ogg/files

Run this command to have ffmpeg batch convert all the .ogg files to mp3:
Code: [Select]
for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_meta_data 0:0,s0 "${name/.ogg/.mp3}"; done;

That will convert ALL the .ogg files to (128k bitrate) .mp3 .. it will automatically change the file extension .. and it will keep all the ID tag metadata.

If you want to use a different bitrate .. just change the 128k to your chosen bitrate.



GUI method .. for everyone else :)

Simple, install the soundconverter package .. or if you're using KDE, soundkonverter

Now use it to convert your files.
« Last Edit: December 29, 2011, 09:47:38 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline rjej123

  • Jr. Member
  • **
  • Posts: 1
  • Karma: 1
  • I've just joined!
    • View Profile
    • Awards
Re: Batch converting .ogg to .mp3 keeping the ID tag metadata
« Reply #1 on: October 21, 2012, 02:52:07 pm »
The command you have provided has some errors

The proper command would be:

for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_metadata 0:s:0 "${name/.ogg/.mp3}"; done;

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 17670
  • Karma: 457
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Batch converting .ogg to .mp3 keeping the ID tag metadata
« Reply #2 on: October 21, 2012, 03:31:41 pm »
Yup, -map_meta_data now appears to be depreciated.

Thanks for the update :)
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline mhvis

  • Jr. Member
  • **
  • Posts: 1
  • Karma: 1
  • I've just joined!
    • View Profile
    • Awards
Re: Batch converting .ogg to .mp3 keeping the ID tag metadata
« Reply #3 on: October 01, 2015, 10:06:19 pm »
I have a response on this old post, first to thank the original poster for this nice command. There was however a problem I encountered on Windows: the tags were not visible in Explorer and WMP (although correctly copied). A solution to this was found here and here and I wanted to share that solution.

So if Windows users have problems with the tags not showing up, one could try this:

Code: [Select]
for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_metadata 0:s:0 -id3v2_version 3 -write_id3v1 1 "${name/.ogg/.mp3}"; done;

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 17670
  • Karma: 457
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Batch converting .ogg to .mp3 keeping the ID tag metadata
« Reply #4 on: October 01, 2015, 10:10:09 pm »
Nice, thanks for that.

and welcome to the forum mhvis :)
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal