블로그 이미지
A Computer Scientist’s View of Life, the Internet, and Everything jaeyounkim

카테고리

분류 전체보기 (230)
Love (4)
Programming (2)
Computer Science (7)
Internet Domain Name (55)
Computer System (14)
Information Techno.. (18)
Conference (3)
Personal Stuff (60)
Schools (20)
Organization (47)
Total369
Today0
Yesterday5

달력

« » 2010.03
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

공지사항

I have been using several Windows applications to convert a music file. Since I got many WMA files recently, I wanted to convert them in my Linux computer.

It was much easier to convert them in Linux than Windows.

You just need to install mplayer, lame, and ffmpeg (optional).

# yum install mplayer lame ffmpeg

Save the following code to wma2mp3.sh. Then, simply run wma2mp3.sh in the same directory of the wma files you want to convert.

# sh wma2mp3.sh

#! /bin/sh
# wma to mp3 shell script

mkdir -p converted_mp3
cp *.wma converted_mp3
cd converted_mp3

# How many files to make the progress bar
PROGRESS=0
NUMBER_OF_FILES=`find -iname "*.wma"`

#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

#edit this if you need to change the options for lame encoding to mp3
FORMAT='lame -h -m s'

#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;
done

#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3";
done

rm audiodump.wav

exit 0

Posted by 김재연 jaeyounkim

최근에 달린 댓글

최근에 받은 트랙백

글 보관함