mp3 snippets

Converting WMA files to MP3 on Linux

Tagged wma, mp3, convert script, bash  Languages bash

Use this to convert WMA files to MP3 in Linux.

# By Marko Haapala
# converts wma to mp3 recursively. does not delete any static files, so 
# cleanup and renaming is needed afterwards. 
# requirements:
# lame    -
# mplayer - apt-get install mplayer or

wma_files=$(find "${current_directory}" -type f -iname "*.wma")
# Need to change IFS or files with filenames containing spaces will not
# be handled correctly by for loop
for wma_file in ${wma_files}; do 
    mplayer -vo null -vc dummy -af resample=44100 \
    -ao pcm -ao pcm:waveheader "${wma_file}" && lame -m s \
    audiodump.wav -o "${wma_file}".mp3
    rm audiodump.wav