LinuxAnswers DiscussionThis forum is to discuss articles posted to LinuxAnswers.
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.
Hi and thanks for that works a treat !
I used it running Fedora core 5, I think was a typo? ":" missing in "-ao pcm:-waveheaders "
as I tried it the first time it barfed out depecrated etc..
otherwise all good
Now I can massage it in Audacity
Ive been using the script submitted by bospaadje above and i dont believe it is running a search on any files that are more than one folder deep
eg if i run the script from /home/glope then /home/glope and /home/glope/1 or /home/glope/2 will be checked however /home/glope/1/1 will not be as its two levels deeper than the original folder the script is run from
Is this assumption correct and if so is there a way around it?
Thanks in advance
It should work (at least, it works for me ). Can you create some .wma files in such a directory, then run
find -iname '*.wma'
from the home directory? On my box this returns every wma file in the directory, no matter how deep in subfolders. If it does so for you too, but the script doesn't rip & encode them, there's a problem with the script. If it doesn't return the files, try adding
to the find command, and if that helps, add it in the script as well. (btw, browsing the man page of find gives me a lot of ideas how this script could be better.. shame all my wma's are already converted )
Yes, I know this is a Linux forum not Windows/Cygwin, but since the scripter asked for improvements, here are some bashisms which you might want to incorporate into your script. I wrote it to call with args, such as:
$ wma2mp3 *.[Ww][Mm][Aa]
And thus can possibly used with a 'find' command to traverse directories (I haven't tried that).
The main difference between this and the Unix script is the syntax for lame:
$ lame --help
LAME 32bits version 3.97 (http://www.mp3dev.org/)
usage: lame [options] <infile> [outfile]
<infile> and/or <outfile> can be "-", which means stdin/stdout.
lame -V2 input.wav output.mp3
-b bitrate set the bitrate, default 128 kbps
-h higher quality, but a little slower. Recommended.
-f fast mode (lower quality)
-V n quality setting for VBR. default n=4
0=high quality,bigger files. 9=smaller files
--preset type type must be "medium", "standard", "extreme", "insane",
or a value for an average desired bitrate and depending
on the value specified, appropriate quality settings will
"--preset help" gives more info on these
--longhelp full list of options
Also I set it for minimum quality (and thus file size); you might want to leave that option out if reducing disk space isn't an issue:
And, it doesn't muck with the file name, it leaves mixed case and spaces as they are; it just changes the extension. As you can see, I will have roughly halved the space my WMA files were taking once I delete the originals:
This is a few years late, but thanks to you folks for the code.
With a few very minor modifications, I can now rip audio from youtube vids (.flv files).
I just changed "wma" to "flv", took out the loop (I don't generally do batch, just a single file or two at a time.) and I'm set. Eventually, I'll tweak it to strip audio from other files.
if [ $1 = ""]
echo "You need to enter the name of the video file you want to rip. Example: rip_flv.sh filename.flv"
current_directory=$( pwd )
for i in *.WMA; do mv "$i" "`basename "$i" .WMA`.wma"; done
#for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; 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 -b 256 -m s audiodump.wav -o $i; done
#convert file names
for i in *.wma; do
neuer_name=`echo $i | tr -s '_' '\ '`
mv "$i" "`basename "$neuer_name" .wma`.mp3";