Page 1 of 6 123 ... LastLast
Results 1 to 10 of 53

Thread: HOWTO: convert wma to mp3

  1. #1
    Join Date
    Feb 2005
    Location
    EU
    Beans
    549
    Distro
    Ubuntu 12.04 Precise Pangolin

    HOWTO: convert wma to mp3

    This small script is for former Windows useres, who want to convert their not DRM "protected" wma's to mp3s.

    Why?
    - some portable music players don't support it
    - it's micro$oft. isn't that enough ?

    Requirements:
    mplayer ,win32 codecs and lame


    but remember: every de- and recoding usually results in a loss of quality, so if you have the original CD,
    rip it again, and do not recode the wma's to mp3's.

    Open a Terminal

    Type:
    Code:
    cd ~/.gnome2/nautilus-scripts
    Type:
    Code:
    gedit convert\ wma\ to\ mp3
    # Paste the following code into the file:
    Code:
    #! /bin/sh
    # wma to mp3 script by mtron
    zenity --info \
            --text="this script converts all wma files in the current folder
    to mp3s and puts them in the folder output 
    
    all lame command line options can be set in the next step. 
    
    usage:
    	lame -m s: for stereo mp3 output
    	lame -m s V 3-4-5: for stereo mp3 output with VBR"
    
    # Dialog box to choose output quality
    FORMAT=`zenity --list --title="Choose mp3 output quality" --radiolist --column="Check" --column="Quality (editable)" --editable "" "lame -m s" "" "lame -m s -V 3" "" "lame -m s -V 4" "" "lame -m s -V 5"`
    
    if [ $FORMAT -eq ""]; then    
    zenity --error --text="mp3 output quality not defined or no wma file found
    
    usage:
    	lame -m s: for stereo mp3 output
    	lame -m s V 3-4-5: for stereo mp3 output with VBR 
     
    type: lame --longhelp 
    for all command line options "
    exit 1
    fi
    
    mkdir -p output
    cp *.wma output
    cd output
    
    # How many files to make the progress bar
    PROGRESS=0
    NUMBER_OF_FILES=`find -iname "*.wma"`
    let "INCREMENT=100/$NUMBER_OF_FILES"
    
    #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 
    echo "$PROGRESS";
    echo "# Re-Coding $i";
    mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && $FORMAT audiodump.wav -o $i;
    let "PROGRESS+=$INCREMENT"
    done
    
    #convert file names
    for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; 
    done
    
    rm audiodump.wav
    let "PROGRESS+=$INCREMENT"
    ) | zenity  --progress --title "$Recoding...encoding..." --percentage=0
    Save the file, and quit gedit.
    Back in the terminal type:

    Code:
    chmod +x convert\ wma\ to\ mp3
    navigate in nautilus to the folder containing the wma's, right click, choose "scripts" and "convert wma to mp3"
    it takes ca. 3 min for one wma. This script will not delete your wma's. all mp3 will be put to the new created folder output. (check that your user has write support in the directory!)

    you can set the lame encoder settings in the zenity dialog box. all lame switches are supported, like

    lame -m s: for stereo mp3 output
    lame -m s V 3-4-5: for stereo mp3 output with VBR"


    Credits: to c m

    Have fun!
    Last edited by mtron; December 6th, 2006 at 09:49 AM.

  2. #2
    Join Date
    Feb 2005
    Beans
    Hidden!

    Re: HOWTO: convert wma to mp3

    Cute.
    What about ape to mp3 or mpc ?
    Sylvia: Look at what you've done to him!
    Christof: I have given Truman the chance to lead a normal life. The world, the place you live in, is the sick place.

  3. #3
    Join Date
    May 2005
    Beans
    11

    Re: HOWTO: convert wma to mp3

    Maybe some tools in here :

    http://rarewares.org/debian.html

    sure for mpc and mp3 but Monkey Audio ?

  4. #4
    Join Date
    Feb 2005
    Location
    EU
    Beans
    549
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: convert wma to mp3

    i'm sorry, i don't have one single ape file...

    but when mplayer is able to play it, the script needs onlya small modification. the same for ogg,

    Perhaps i will make a version to choose the input - and output format.
    for wma, mp3 and ogg it should not be a big problem, but i need to figure out how to use the zenity radiobox input further in the script. Not only the $FOMAT variable.

    when you set the
    FORMAT=... "mp3" "" "ogg" "" "ape"

    you can't use it later wit the switches
    if [ $FORMAT -eq "mp3"]; then
    or
    if [ $FORMAT -eq "ogg"]; then

    or at least i could not. Someone an idea how to do this?

  5. #5
    Join Date
    Oct 2004
    Location
    Århus, Denmark
    Beans
    70
    Distro
    Dapper Drake Testing/

    Re: HOWTO: convert wma to mp3

    If there's support for wma in gstreamer I would like to add that the following converts wma to ogg vorbis:

    gst-launch-0.8 filesrc location=path-to-file/name-of-file.wma ! spider ! vorbisenc ! filesink location=path-to-file/name-of-destination-file.ogg

    for mp3 conversion replace vorbisenc with lame bitrate=128 and of course change postfix to mp3.

  6. #6
    Join Date
    Aug 2006
    Beans
    Hidden!

    Thumbs down Re: HOWTO: convert wma to mp3

    How to convert ape to mp3? Off topic for the thread, but a searching for it landed me here, so here 'tis: I ran into that .ape problem last night, and this brute force method worked out OK:

    Go to www.monkeysaudio.com and download the author's Win32 binary tool for converting into and out of .ape format. (Gratis but not free, hence the lack of a Linux package.) Drop the installer in some convenient location, and run it with "WINE Windows emulator". This will install the software into a hidden directory tree in your /home/[user] that spoofs a standard Windows file system.

    If your shell command options don't include WINE and Wine Windows Emulator, you may have to install these as well. No sweat, just use Synaptic or your favorite package manager.

    Once Monkey Audio is installed, fire up your favorite file navigator, set it to show hidden files, and navigate to the ".wine/drive c/program files/Monkey's Audio/" directory, where you will find "Monkey's Audio.exe" Open up the app and ... just do it.

    I also installed soundKonverter so I could take the .wav files Monkey handed me and conveniently batch convert them to MP3. (You will also need LAME if it is not already installed.) It's native to KDE but works fine under Gnome, at least on my system.

  7. #7
    Join Date
    Aug 2006
    Beans
    80

    Re: HOWTO: convert wma to mp3

    i did all you asked but it doesnt work for me.
    it says converting but then the folder output is empty.
    is there something relating to it i need to install?

  8. #8
    Join Date
    Sep 2006
    Beans
    31

    Re: HOWTO: convert wma to mp3

    the trick is to use the script INSIDE the folder. I first also tried to do things on the top folder...

    but it would be a nice feature...

  9. #9
    Join Date
    Jul 2006
    Beans
    49

    Re: HOWTO: convert wma to mp3

    pacpl does all of this and more. a new version was
    just released. see http://viiron.googlepages.com/home

    -David

    Perl Audio Converter (PAC) is a tool for converting multiple audio
    types from one format to another. It supports MP2, MP3, Ogg Vorbis,
    FLAC, Shorten, Monkey Audio, FAAC (AAC/M4A/MP4), Musepack (MPC),
    Wavpack (WV), OptimFrog (OFR/OFS), TTA, LPAC, Kexis (KXS), AIFF, AC3,
    Lossless Audio (LA), BONK, AU, SND, RAW, VOC, SMP, RealAudio (RA/RAM),
    WAV, and WMA. It can also convert audio from the following video
    formats/extensions: RM, RV, ASF, DivX, MPG, MKV, MPEG, AVI, MOV, OGM,
    QT, VCD, VOB, and WMV. A CD ripping function with CDDB support, batch
    and playlist conversion, tag preservation for most supported formats,
    independent tag reading/writing, and extensions for Konqueror and
    amaroK are also provided.

  10. #10
    Join Date
    Sep 2006
    Beans
    31

    Re: HOWTO: convert wma to mp3

    there is a bug in the script:

    mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && $FORMAT audiodump.wav -o $i;

    needs to get

    mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && $FORMAT audiodump.wav -o $i;

    ...at least on dapper with the latest updates installed. otherwise the files just get renamed.

Page 1 of 6 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •