SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-05-13 04:05:55

crunchy
#! Junkie
From: Juneau, AK, USA
Registered: 2010-08-19
Posts: 461

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!

Offline

Be excellent to each other!

#2 2011-05-13 07:36:30

Kaokao
#! Member
From: The Netherlands
Registered: 2011-04-27
Posts: 50

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.

Offline

#3 2011-05-13 17:07:00

crunchy
#! Junkie
From: Juneau, AK, USA
Registered: 2010-08-19
Posts: 461

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!

Offline

#4 2011-05-14 16:09:06

Kaokao
#! Member
From: The Netherlands
Registered: 2011-04-27
Posts: 50

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.

Offline

#5 2011-05-14 18:29:12

merelyjim
#! Die Hard
From: Fort Worth, Texas
Registered: 2010-04-07
Posts: 2,296
Website

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!


"When I enter a command... I expect ass to be hauled and the coffeelike aroma of hustle delicately hovering in the air." -thalassophile

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

Offline

#6 2011-05-15 01:08:04

crunchy
#! Junkie
From: Juneau, AK, USA
Registered: 2010-08-19
Posts: 461

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!

Offline

#7 2011-05-15 08:01:37

olembe
#! Junkie
From: Salisbury, England
Registered: 2009-04-29
Posts: 260

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

Offline

#8 2012-08-11 10:29:58

Heedy Po
Member
Registered: 2012-01-31
Posts: 10

Re: mp3/wma-to-ogg

Hi,

Not sure if I should be reactivating this topic or creating a new one (?), but here goes anyway.

My music collection is spread across a bunch of formats... mp3, wma, flac etc. I am trying to tidy things up. I can, using ffmpeg,  convert single directories but I have approx 400 GB of music and the process is somewhat ‘slow’.

What I’m looking for is a ffmpeg command to convert multiple non-ogg audio formats in all my music directory tree simultaneously to ogg. The answer to this topic goes some way to solving my problem but is not quite there. I wonder if there is a more direct way. My ffmpeg knowledge is not deep enough yet - apologies.

Thanks in advance for any help you can provide.

Cheers

Heedypo


We are a nice, friendly community here and I hope we stay that way.
"The first draft of anything is sh*t" - Ernest Hemingway

Offline

#9 2012-08-11 12:29:40

pidsley
#! Die Hard
Registered: 2012-05-23
Posts: 1,439

Re: mp3/wma-to-ogg

You might get better help if you open a new topic.

Do you know the commands to convert the various formats you have? I don't think this can be done with a single command, but it would not be too hard to write a script if you know the commands for each format.


Want Waldorf, but with sid and systemd? Try Darkside.

Offline

#10 2012-08-11 12:39:05

Heedy Po
Member
Registered: 2012-01-31
Posts: 10

Re: mp3/wma-to-ogg

Hi Pidsley,

Re the new topic, I think you might be right. I did try but the forum would not let me - something about about permissions. Of course I could just have been being a muppet , (no #i  pun intended),and doing something wrong.

Thanks for the reply. I think I will try and write a script myself - should be educational.

Cheers

Heedypo


We are a nice, friendly community here and I hope we stay that way.
"The first draft of anything is sh*t" - Ernest Hemingway

Offline

#11 2012-08-11 12:58:03

pidsley
#! Die Hard
Registered: 2012-05-23
Posts: 1,439

Re: mp3/wma-to-ogg

To get you started, here's a script that uses a case statement to do different things depending on the file extension: http://crunchbanglinux.org/forums/post/212728/#p212728

(there are other handy scripts in that topic, they might give you some ideas)


Want Waldorf, but with sid and systemd? Try Darkside.

Offline

#12 2012-08-11 13:00:42

Heedy Po
Member
Registered: 2012-01-31
Posts: 10

Re: mp3/wma-to-ogg

Thanks Pidsley... That's the rest of the weekend sorted then smile


We are a nice, friendly community here and I hope we stay that way.
"The first draft of anything is sh*t" - Ernest Hemingway

Offline

#13 2012-08-11 14:29:41

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,248

Re: mp3/wma-to-ogg

pidsley wrote:

You might get better help if you open a new topic.

Do you know the commands to convert the various formats you have? I don't think this can be done with a single command, but it would not be too hard to write a script if you know the commands for each format.

If your goal it to convert them all to the same bitrate, you should be able to use a single-line find command to do this.

find . -type f \( -iname '*.wma' -o -iname '*.mp3' \) -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg

Then another similar single-line command to remove the files with the offensive extensions. wink


while ( ! ( succeed = try() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Offline

#14 2012-08-11 15:07:46

Heedy Po
Member
Registered: 2012-01-31
Posts: 10

Re: mp3/wma-to-ogg

Hi Pvsage

Thanks, I will have a play around with a few examples to test.

Much appreciated

Heedypo


We are a nice, friendly community here and I hope we stay that way.
"The first draft of anything is sh*t" - Ernest Hemingway

Offline

#15 2012-08-11 15:24:16

brontosaurusrex
#! Die Hard
Registered: 2012-06-15
Posts: 557

Re: mp3/wma-to-ogg

just some notes;

a. built in vorbis encoder was classified as borken in 2010 (no idea if that was fixed meantime)
http://xiphmont.livejournal.com/51160.html
http://www.linuxquestions.org/questions … is-782346/
b. personally i would not use bitrate based encoding, but quality one, like
-f ogg -acodec libvorbis -aq 6
http://wiki.hydrogenaudio.org/index.php … r_Settings

Last edited by brontosaurusrex (2012-08-11 15:25:48)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo