Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 07-19-2005, 03:00 PM   #16
Senior Member
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52

Oh boy.... Here... Do this...

Everything that you see below in the code box, highlight ALL of it and then right click and COPY.
# wma to mp3

function wma2mp3 () {

if [ ! -f "$1" ]; then

  echo "File $1 not found!"


  wav=`ls "$1" | sed -e 's/.wma/.wav/' | tr -d "*"`
  mplayer -ao pcm "${1%%.[Ww][Mm][Aa]}.wav" "$1" &&
  mv audiodump.wav "$wav" && unset wav &&
  lame -h -b 192 "${1%%.[Ww][Mm][Aa]}.wav" "${1%%.[Ww][Mm][Aa]}.mp3" &&
  rm -f "${1%%.[Ww][Mm][Aa]}.wav" ||
  echo "There was a problem with the conversion process!"



# convert all wma files in directory

if [ $# -eq 1 -a -d "$1" ]; then

for file in $1/*.[Ww][Mm][Aa]; do
  wma2mp3 "$file"


# One or more wma files were given

for file in $*; do

  wma2mp3 "$file"


# Not enough information

if [ $# -lt 1 ]; then

  echo "Usage:	wma2mp3 myfile.wma"
  echo "	wma2mp3 /directory/containing/wma/files"
  echo "	wma2mp3 myfile.wma myfile2.wma myfile3.wma"
  # You have to use quotations for the arguement below.
  # Failure to do so will result in only one file being
  # converted. Namely, the first one it comes across...
  echo '	wma2mp3 "*.wma"'
  echo "For converting .wma's that have spaces in the"
  echo 'name, use the directory option OR "*.wma"'


Once you have that copied, PASTE it into a blank text pad. Gedit, Kedit, Kwrite... Whatever 'notepad' type of program you happen to use in linux.

So when you click on SAVE, it will ask you where you want to save it. Save it in "/usr/bin" and save the file with the name of "wma2mp3". So.... That should give you a "/usr/bin/wma2mp3". You can even click on your desktop's HOME icon, hit the "UP" arrow button twice and then browse to /usr/bin just to make sure you see a file called "wma2mp3" in there.

Once you have that, open up a Terminal. That would be xterm,gnome-terminal,konsole,aterm,eterm or whatever 'Terminal' that you have on your system. Look in your applications menu. If your using Gnome, that's the "foot" icon in the bottom left of your screen. If your using KDE, that's the "K" icon in the bottom left of your screen (atleast I think it's a K). You should find a Terminal somewhere in there. Once you have an open terminal, type this line into it.
chmod 755 /usr/bin/wma2mp3
and hit ENTER... Now, while you have that same Terminal window open, use it to navigate to the directory where you are keeping your .wma files.... If all your .wma files are hypothetically in "/home/billybob/music" then type this into your Terminal window.
cd /home/billybob/music
The press ENTER... Now you can type this at that same terminal window.
wma2mp3 "*.wma"
Sit back and wait a few minutes depending on how many .wma files you may have in that directory. If you get an error like:
lame: no such file or directory
Then you don't have lame installed. Install that and then try again. Same goes with 'mplayer'

Last edited by jong357; 07-19-2005 at 03:12 PM.
Old 07-19-2005, 04:34 PM   #17
Registered: Jun 2004
Distribution: Slackware
Posts: 199

Rep: Reputation: 32
When converting from wma -> wav -> mp3, is information or quality lost?
Old 07-20-2005, 02:07 AM   #18
Senior Member
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
yes. Ussually you can't really tell a difference. Not unless you have a REALLY good ear. You can also tweak all those scripts out in the WIKI so they use better encoding/quality rates. I tried to keep them reasonable so you wouldn't end up with an overly large file when you were done. When ever you convert audio or video, your going to loose quality. Ussually it's a trivial ammount tho, especially with audio. People typicaly have better eyes than they do ears...

Last edited by jong357; 07-20-2005 at 02:08 AM.
Old 07-20-2005, 03:06 AM   #19
Registered: Jul 2005
Posts: 56

Original Poster
Rep: Reputation: 15
thank you jong357
Old 07-20-2005, 05:22 AM   #20
Registered: Oct 2003
Location: Kuala Lumpur, Malaysia
Distribution: Slackware 13.37 current
Posts: 770

Rep: Reputation: 33
wma to mp3 conversion is very audible because both are lossy formats, but use different methods. The net result is that too much information has been lost.
You would be better off converting to uncompressed wav or the lossless flac format (about 50% reduction). Then at least the quality should be the same as the original wma file.
Old 07-20-2005, 09:53 AM   #21
Registered: Jul 2005
Posts: 56

Original Poster
Rep: Reputation: 15
but my mp3 player doesn't play wma files so i want to change my wma files to mp3

thats ok.
Old 09-23-2006, 05:11 AM   #22
Registered: Mar 2002
Location: London
Distribution: Red Hat 9
Posts: 302

Rep: Reputation: 30
there are a lot of reasons you might want to convert from one audio format to another, so this script would indeed be useful to many people. Also, it encodes at 192 kbps which i agree is a sensible compromise in terms of quality and filesize. By comparison 128 kbps is usually referred to as "CD quality" when it comes to mp3s. Plus your wma file is probably not too great sound quality in the first place unless you ripped your own CDs to wma files, in which case it's your own fault you've got wma files in the first place, plus if you need the mp3s then you can just get out your CDs.

i actually did a similar script, it's since grown into a set of scripts to do a lot of different audio conversions, and if you're interested it can be found here:

EDIT: well, i just saw the scripts here which pretty muc do all that my scripts do as well as preserving the ID3 tags, so that makes me feel a little redundant! nevermind! :-D

Last edited by Calum; 09-23-2006 at 05:18 AM.
Old 09-23-2006, 05:26 AM   #23
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Tweak your mp3player, put a small Linux inside and make it play Ogg Vorbis - or any other format of your choice (.ogg is just a slightly better choice than .mp3, for various reasons)
Old 09-23-2006, 10:07 AM   #24
Senior Member
Registered: Mar 2004
Location: Westray, Orkney
Distribution: Linux Mint 17.1
Posts: 1,424

Rep: Reputation: 138Reputation: 138
OK so converting a wma to an mp3 is easy, but the real problem comes with drm encryption.

I have one wma track that I legally downloaded and I hate having the limitation that I can only play it on my laptop. The music is good the sound on the laptop is extremely poor.

Is there a player available to the world of linux that will play a drm encrypted wma file legally.



mp3, ogg, 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
wma to mp3 pulsez Linux - Newbie 5 10-27-2005 08:17 PM
MP3 to WMA spotslayer Linux - Software 5 10-08-2004 05:45 PM
how to convert a wma to mp3?? yenonn Linux - General 2 04-26-2004 08:25 PM
Is WMA better than MP3 Imek General 6 12-04-2003 03:02 PM
converting wma to mp3 rolanaj Linux - Software 2 08-16-2003 04:46 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:05 AM.

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