You are not logged in.

#1 2006-02-22 23:15:32

Greycloack
Member
Registered: 2004-03-05
Posts: 166

Converting WMA to MP3 script help

Hi I've found this script on the net that should convert wma to mp3 :

#!/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

I'v found it on http://www.linuxquestions.org/linux/ans … WMA_to_MP3

The problem is when I run it I get:

MPlayer 1.0pre7try2-4.0.3 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium M Banias (Family: 6, Stepping: 5)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with --disable-runtime-cpudetection.

Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your system startup                                                                                           scripts.
Playing 01_big_machine.wma.
ASF file format detected.
Clip info:
 name: Big Machine
 author: Goo Goo Dolls
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24002->176400)
Selected audio codec: [ffwmav2] afm:ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
Checking audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...


MPlayer interrupted by signal 11 in module: af_preinit
- MPlayer crashed by bad usage of CPU/FPU/RAM.
  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and
  disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.
- MPlayer crashed. This shouldn't happen.
  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
  gcc version. If you think it's MPlayer's fault, please read
  DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
  won't help unless you provide this information when reporting a possible bug.
rm: cannot remove `audiodump.wav': No such file or directory

And I have no idea why - I don't really know Bash very well...
can anyone help me please?

EDIT : fixed the error message, but it still doesn't work :-(

Offline

#2 2006-02-23 16:16:19

mac57
Member
From: St. Somewhere
Registered: 2006-01-06
Posts: 302
Website

Re: Converting WMA to MP3 script help

Is it possible that you got the WMAs you are trying to convert from an online music service, and they are protected by Digital Rights Management?


Cast off the Microsoft shackles Jan 2005

Offline

#3 2006-02-23 16:19:54

Greycloack
Member
Registered: 2004-03-05
Posts: 166

Re: Converting WMA to MP3 script help

Nope...
when I run mplayer and simply open the file it plays perfectly.

When I run the script all the files change their name to .mp3 but the file content is still wma.

I guess the problem is somewhere with piping the output into the wave file or something...

Offline

#4 2006-02-25 18:24:21

Neuro
Member
From: Poland
Registered: 2005-10-12
Posts: 352

Re: Converting WMA to MP3 script help

Well, I've done a similar script myself for my personal use: Audioconvert.
Type ./audiocovert.sh --help for help. To convert a wma file to mp3 do

./audioconvert.sh --format mp3 file.wma

I hope this one helps you.

Offline

#5 2006-02-26 12:23:42

Greycloack
Member
Registered: 2004-03-05
Posts: 166

Re: Converting WMA to MP3 script help

Thanks a lot, the script works perfectly :-)

Offline

#6 2006-05-26 17:01:11

K2712
Member
From: Greenville, SC
Registered: 2006-05-17
Posts: 28

Re: Converting WMA to MP3 script help

Neuro wrote:

Well, I've done a similar script myself for my personal use: Audioconvert.
Type ./audiocovert.sh --help for help. To convert a wma file to mp3 do

./audioconvert.sh --format mp3 file.wma

I hope this one helps you.

I saved your script in a folder full of wave files, entered:

$ ./audioconvert.sh --format mp3 Intro.wma

And got:

-bash: ./audioconvert.sh: Permission denied

Permissions and ownership aren't the problem, as I get the same thing as root, any ideas?

Offline

#7 2006-05-26 17:04:49

codemac
Member
From: North Carolina
Registered: 2005-05-13
Posts: 776
Website

Re: Converting WMA to MP3 script help

chmod +x audioconvert.sh

Just to let every know:

If you are getting permission errors of any kind in an script, your first step should be to not run the script with root.

Permissions fail for a reason. You shouldn't just hand them out the second something complains.

Offline

#8 2006-05-26 17:32:49

K2712
Member
From: Greenville, SC
Registered: 2006-05-17
Posts: 28

Re: Converting WMA to MP3 script help

Thanks for the help,  I guess I still have a bit to learn about permissions...

Offline

Board footer

Powered by FluxBB