Topic: mp3/wma-to-ogg

I've been playing around with this lately and have created this:

#!/bin/sh

find -iname '*.mp3' -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg \;
rename 's/\.mp3//' *\.mp3\.ogg
rm *.mp3
#!/bin/sh

find -iname '*.wma' -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg \;
rename 's/\.wma//' *\.wma\.ogg
rm *.wma

make them executable and run them in the terminal, they will convert all of the mp3s of wmas into oggs

***********************************
***********************************
***********************************
THIS WILL DELETE THE ORIGIONAL WMAS OR MP3S
***********************************
***********************************
***********************************

have fun!

Last edited by crunchy (2011-05-15 01:10:06)

registered Linux user: #533379
registered #! user: #6769
Whenever someone calls me a computer 'nerd' or a 'Unix-based-system'
all I can think is: You just wait. In a couple of years. I'll be your IT. Then where will you be!

Re: mp3/wma-to-ogg

You do know transcoding between lossy formats degrades sound quality right?

Also, wouldn't it be better to add a dot before the file extension, e.g. *.mp3? Otherwise the script also picks up a file named temp3, for example.

Re: mp3/wma-to-ogg

Kaokao wrote:

You do know transcoding between lossy formats degrades sound quality right?

Also, wouldn't it be better to add a dot before the file extension, e.g. *.mp3? Otherwise the script also picks up a file named temp3, for example.

yes, I know that it degrades the sound quality, the only reason that I'm doing this is that I have a lot of music and only so much space on my mp3-player. I personally can't notice a difference when playing back music, also some music players can't play wmas.

as for the *.mp3. I could try that but I don't think that it would make a difference because the "." symbol can mean any letter or number (am I right) maybe if I backslash the dot?

it's worked so far, I have a backup on my harddrive if anything goes wrong. smile

registered Linux user: #533379
registered #! user: #6769
Whenever someone calls me a computer 'nerd' or a 'Unix-based-system'
all I can think is: You just wait. In a couple of years. I'll be your IT. Then where will you be!

Re: mp3/wma-to-ogg

That's a valid reason big_smile

I think you're right regarding the dot meaning any character in regular expressions, but it doesn't seem to fly here. When I create a file called temp3 in a directory containing MP3-files and then do a

find -name '*mp3'

it finds temp3 and the MP3s. However with

find -name '*.mp3'

it only finds the MP3s, not temp3. But if you really want to know the nitty-gritty you'd better read the man-page.

Another thing that I now notice: better use find -iname instead of -name, the i is for case-insensitive. That way it will also find mp3s with capitalized extension (e.g. Who let the dogs out.MP3). You might need to do something like this in the 2nd and 3rd lines too, depending on if the rename and rm commands are also case sensitive by default, but I think this is always the case on Linux.

Re: mp3/wma-to-ogg

Just for fun, there's a program called rip-it [sudo apt-get install ripit] that will rip CD's to FLAC, OGG, or MP3... from the command line! Always fun.

I use a Cowon I Audio7, which reads just about every audio codex on the planet - including APE (which I've never seen in the wild... insert Groucho Marks joke here). Very good sound quality. smile

Very cool script!

Death and I have a working relationship.
Anyone touches my coffee I send him some business.  Sector11

My attempt at a blog; http://jims2011.blogspot.com/

Re: mp3/wma-to-ogg

@kaokao
Thanks, you're right, I'll change the script. smile

@merelyjim that sounds like a cool program! I'll have to give it a try! smile I've always used asunder which rips cds into oggs.

Last edited by crunchy (2011-05-15 01:11:22)

registered Linux user: #533379
registered #! user: #6769
Whenever someone calls me a computer 'nerd' or a 'Unix-based-system'
all I can think is: You just wait. In a couple of years. I'll be your IT. Then where will you be!

Re: mp3/wma-to-ogg

As well as Ripit, there is the wonderfully simple and efficient abcde in the repos which is my preferred CD ripper