LinuxAnswers DiscussionThis forum is to discuss articles posted to LinuxAnswers.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I couldn't actually get the script to work. Firstly it complained because the "-ao pcm -waveform" bit was now not used, and then mplayer just kept on crashing. So I modified the script a bit to suit my needs, in case anyone wants it. It converts to OGG not MP3 (although changing the oggenc line to lame would convert to MP3) and its not as neat as the original because I'm a complete noob, but it works for me!
Code:
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer
for i in *.wma ; do mplayer -vo null -vc dummy -ao pcm:file=$i.wav $i; done
#Convert to OGG
oggenc *.wav;
# Delete WAV files
rm *.wav;
I hope that helps someone! :-D It will need a lot more disc space than the original because it rips all of the files to WAV first, then converts them to OGG, then deletes the original WAVs, so you have 3 copies of each song on your drive at one point. But as I say - I'm a complete noob!
I'm having trouble modifying this wma-->mp3 script to convert wma--> wav
when I remove part of the line that deals with reencoding to mp3, the process breaks.
see the bottom for more of my explanation.
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm - waveheader $i && lame -m s audiodump.wav -o $i; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i ; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.wav"; done
PROBLEM:
After removing section of the line that reencoded the audiodump.wav file to mp3, the audiodump file just gets overwritten by each subsequent conversion, so i'm left with a bunch of wma's that have the wav extension, and ONE wav file (audiodump.wav) which was the last file that got converted. Help please :-) (My reason for wanting WAV files is for easy burning to CD, if I'm correct wav is the easiest format to burn from.
Originally posted by mpm
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i ; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.wav"; done
[/B]
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && mv audiodump.wav "$i".wav; done
(you'll get something like aaaa.wma.wav)
Check the other link i posted! It can create wav's as default.
Thanks Acker,
Changing the script as you suggested worked, although I would probably like to have it replace the wma rather than append it so I didn't get the .wma.wav extension, but that's a minor point. I dl'ed the py script you linked to and it works very nicely, and I like its versitality for recursion and multiple file formats. Next obstacle ahead: maximizing gnomebaker's cd-audio compatibility with my older rotel cd-player. :-)
@mpm: I didn't thought that you're going to keep those files on the hard drive. They are pretty big.
To rename the files to aaaa.wav and not aaaaa.wma.wav you shoud use instead of
mv audiodump.wav "$i".wav
this command (inserted in that for i ...)
mv audiodump.wav "`basename "$i" .wma`.wav"
I think this would work. (I don't run dangerous commands on my box :)) )
Excellent, thanks again Acker I'll try it, although now that I have that other script you linked to I'll probably use that one.
You say you don't run dangerous commands on you box? What do you mean, you would consider these types of command to be potentially dangerous?
Originally posted by mpm You say you don't run dangerous commands on you box? What do you mean, you would consider these types of command to be potentially dangerous?
Didn't you see the :)) ? I was just kidding. I warned you that I haven't run the commands, and therefore I can not really guarantee for their accuracy. (I haven't programmed in bash yet)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.