LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion
User Name
Password
LinuxAnswers Discussion This forum is to discuss articles posted to LinuxAnswers.

Notices

Reply
 
Search this Thread
Old 05-29-2005, 03:52 PM   #16
pembo13
Member
 
Registered: May 2003
Location: Caribbean
Distribution: Fedora Core2
Posts: 403

Rep: Reputation: 30

Thanks for the script, but I have a few questions:

1) Is it really necessary to remove the spaces in the file name?

2) and, I am not good at bash, how can I upper case the first letter of every word?\

Thanks.
 
Old 06-09-2005, 10:16 AM   #17
Kropotkin
Member
 
Registered: Oct 2004
Location: /usr/home
Distribution: Fedora, Mint, FreeBSD, Android
Posts: 348

Rep: Reputation: 31
Thumbs up nice

Thanks to whoever posted this script here; it is very useful. I made one small modification:
Code:
lame --preset standard
VBR instead of the default 128kb/s bitrate.
 
Old 06-15-2005, 08:28 AM   #18
JamieBrown
Member
 
Registered: Jan 2005
Location: Great Ayton, North Yorkshire, UK
Distribution: Gentoo, Mandriva, RHES, Debian
Posts: 61

Rep: Reputation: 15
Hello,

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!

Bye for now!

Jamie.
 
Old 06-15-2005, 10:23 AM   #19
cadj
Member
 
Registered: Aug 2003
Location: Melbourne Australia
Distribution: LinuxMint Elyssa
Posts: 373

Original Poster
Rep: Reputation: 32
to save on disk space, you could remove the file after ripping it, to lay out the code in an easy to understand way
Code:
for i in *.wma ; do 
    echo Processing file: $i
    mplayer -vo null -vc dummy -ao pcm:file=$i.wav $i; 
    rm $i
done
you can put in as many commands as you want
 
Old 06-15-2005, 11:15 AM   #20
JamieBrown
Member
 
Registered: Jan 2005
Location: Great Ayton, North Yorkshire, UK
Distribution: Gentoo, Mandriva, RHES, Debian
Posts: 61

Rep: Reputation: 15
Cool. Looks good. Anyone know if its possible to go recursively through the subdirectories too? Bit of a bugger having to go into each folder.
 
Old 06-15-2005, 07:04 PM   #21
cadj
Member
 
Registered: Aug 2003
Location: Melbourne Australia
Distribution: LinuxMint Elyssa
Posts: 373

Original Poster
Rep: Reputation: 32
Code:
for i in $(find -iname *.wma); do
just learnt this yesterday doing the same thing with converting images
 
Old 06-16-2005, 04:06 AM   #22
JamieBrown
Member
 
Registered: Jan 2005
Location: Great Ayton, North Yorkshire, UK
Distribution: Gentoo, Mandriva, RHES, Debian
Posts: 61

Rep: Reputation: 15
Great! Nice one cadj! Thanks for your help - I now think I have my perfect WMA to OGG/MP3 converter! :-)
 
Old 07-02-2005, 03:33 PM   #23
mpm
LQ Newbie
 
Registered: Jul 2005
Location: california, usa
Distribution: kubuntu
Posts: 6

Rep: Reputation: 0
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

rm audiodump.wav

-------------------------------------------------------------------
modified script-------------------------------------------------
#!/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 ; 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.

Thank you in advance.
 
Old 07-06-2005, 09:57 AM   #24
acker
Member
 
Registered: Apr 2004
Location: Timisoara, Romania
Distribution: Debian
Posts: 90

Rep: Reputation: 15
Found this: http://seismic.ocean.dal.ca/~leblanc...onversion.html
It requires python and a small modification if you have a newer version of mplayer.

It takes the Artist and Title from the Wma which i think it's a good thing.
 
Old 07-06-2005, 10:09 AM   #25
acker
Member
 
Registered: Apr 2004
Location: Timisoara, Romania
Distribution: Debian
Posts: 90

Rep: Reputation: 15
Quote:
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.
 
Old 07-06-2005, 09:50 PM   #26
mpm
LQ Newbie
 
Registered: Jul 2005
Location: california, usa
Distribution: kubuntu
Posts: 6

Rep: Reputation: 0
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. :-)
 
Old 07-07-2005, 02:18 PM   #27
acker
Member
 
Registered: Apr 2004
Location: Timisoara, Romania
Distribution: Debian
Posts: 90

Rep: Reputation: 15
@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 :)) )
 
Old 07-07-2005, 09:45 PM   #28
mpm
LQ Newbie
 
Registered: Jul 2005
Location: california, usa
Distribution: kubuntu
Posts: 6

Rep: Reputation: 0
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?
 
Old 07-08-2005, 04:00 PM   #29
acker
Member
 
Registered: Apr 2004
Location: Timisoara, Romania
Distribution: Debian
Posts: 90

Rep: Reputation: 15
Quote:
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)
 
Old 07-10-2005, 07:45 AM   #30
flebber
Member
 
Registered: Jan 2005
Location: Newcastle, Australia
Distribution: debian stable
Posts: 394

Rep: Reputation: 30
I tried the instructions and ended up with this error not sure

[root@localhost Music]# wmamp3
mv: `Alcohol.wma' and `Alcohol.wma' are the same file
MPlayer 1.0pre7-3.3.1 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 9)
Detected cache-line size is 64 bytes
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2

-waveheader is deprecated. Use -ao pcm:waveheader instead.
/usr/bin/wmamp3: line 12: lame: command not found
MPlayer 1.0pre7-3.3.1 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 9)
Detected cache-line size is 64 bytes
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2

I am going to install lame but what is the go with waveheader.
 
  


Reply

Tags
amarok, convert, mp3, wma


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert wma to ogg lixy Linux - Software 20 10-12-2011 06:58 PM
convert wma > mp3? andrewlkho Linux - Software 31 08-20-2007 01:26 AM
wma to mp3 pulsez Linux - Newbie 5 10-27-2005 08:17 PM
Any program that can convert mp3 files to wma? josh_hd_new Linux - Newbie 1 01-21-2005 03:03 AM
how to convert a wma to mp3?? yenonn Linux - General 2 04-26-2004 08:25 PM


All times are GMT -5. The time now is 08:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration