[分享]wma转换成mp3的脚本程序
-
- 帖子: 27
- 注册时间: 2005-10-04 21:00
[分享]wma转换成mp3的脚本程序
最近在学习shell编程,发现满有意思的
正好下了一些喜欢的歌曲,是wma,用bmp不能播放
于是想写一个脚本,批量转换下,感觉满好玩的
就和大家share下。这个脚本能转换脚本所在目录下的所有wma文件
当然,运行这个脚本的前提是要求系统安装有mplayer和lame
====================
#!/bin/bash
ls *.wma > filelist.txt
filename=`head -1 filelist.txt`
while [ -n "$filename" ];
do
mplayer -vo null -ao pcm "$filename"
rm -f "$filename"
filename=`echo $filename|sed 's/wma/mp3/g'`
lame -h audiodump.wav "$filename"
ls *.wma > filelist.txt
filename=`head -1 filelist.txt`
done
rm -f audiodump.wav
rm -f filelist.txt
rm -f *~
====================
正好下了一些喜欢的歌曲,是wma,用bmp不能播放
于是想写一个脚本,批量转换下,感觉满好玩的
就和大家share下。这个脚本能转换脚本所在目录下的所有wma文件
当然,运行这个脚本的前提是要求系统安装有mplayer和lame
====================
#!/bin/bash
ls *.wma > filelist.txt
filename=`head -1 filelist.txt`
while [ -n "$filename" ];
do
mplayer -vo null -ao pcm "$filename"
rm -f "$filename"
filename=`echo $filename|sed 's/wma/mp3/g'`
lame -h audiodump.wav "$filename"
ls *.wma > filelist.txt
filename=`head -1 filelist.txt`
done
rm -f audiodump.wav
rm -f filelist.txt
rm -f *~
====================
“被ubuntu所感动,也想为它和大家做点什么”
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
代码: 全选
$ cat ~/bin/dumpwma2mp3.sh
#!/bin/bash
#
# Dump wma to mp3
for i in *.wma
do
if [ -f $i ]; then
rm -f audiodump.wav
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$i"
dest=../wma2mp3/`echo "$i"|sed -e 's/wma$/mp3/'`
lame -h -m j --vbr-new -b 196 audiodump.wav "$dest"
rm -f audiodump.wav
fi
done
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
alias 爱慕颇雷尔='mplayer'
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
代码: 全选
$ cat ~/bin/dumpwma2mp3v2.sh
#!/bin/bash
#
# Dump wma to mp3
PATH=/opt/lame-3.97/bin:/opt/mplayer/bin:$PATH
for i in *.wma
do
if [ -f "$i" ]; then
rm -f audiodump.wav
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$i"
dest=../huarennangeshou_wanzhenggaoqing/`echo "$i"|sed -e 's/wma$/mp3/'`
if [ ! -f "$dest" ]; then
lame -h --cbr -b 96 --resample 44.1 audiodump.wav "$dest"
fi
dest=../huarennangeshou_wanzhenggaosu/`echo "$i"|sed -e 's/wma$/mp3/'`
if [ ! -f "$dest" ]; then
lame -h --cbr -b 32 --resample 24 audiodump.wav "$dest"
fi
rm -f audiodump.wav
fi
done
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
alias 爱慕颇雷尔='mplayer'
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
- yjcong
- 帖子: 2470
- 注册时间: 2006-02-28 3:11
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
- HuntXu
- 帖子: 5776
- 注册时间: 2007-09-29 3:09
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
- skyx
- 论坛版主
- 帖子: 9202
- 注册时间: 2006-12-23 13:46
- 来自: Azores Islands
- 联系:
- zhuqin_83
- 帖子: 10606
- 注册时间: 2006-05-13 4:02
- 联系: