You are not logged in.
Pages: 1
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 *.wmamake 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
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
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. 
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
That's a valid reason 
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
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. 
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
@kaokao
Thanks, you're right, I'll change the script. 
@merelyjim that sounds like a cool program! I'll have to give it a try!
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
As well as Ripit, there is the wonderfully simple and efficient abcde in the repos which is my preferred CD ripper
Offline
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
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
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
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
Thanks Pidsley... That's the rest of the weekend sorted then 
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
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 {}.oggThen another similar single-line command to remove the files with the offensive extensions. 
while ( ! ( succeed = try() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.
Offline
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
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
Pages: 1
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.