wma to mp3 的一个脚本!

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
yysq009
帖子: 2682
注册时间: 2007-01-28 23:00
来自: @江西|南昌@
联系:

wma to mp3 的一个脚本!

#1

帖子 yysq009 » 2008-10-20 20:57

By cadj

无意在网路上找到的,不敢独享。
需求是:
mplayer
luma

代码: 全选

#!/bin/bash

current_directory=$( pwd )

#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 mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && lame -m s audiodump.wav -o $i; done

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

rm audiodump.wav

Do as you would be done by !
头像
yysq009
帖子: 2682
注册时间: 2007-01-28 23:00
来自: @江西|南昌@
联系:

Re: wma to mp3 的一个脚本!

#2

帖子 yysq009 » 2008-10-20 20:59

还有另一个版本:

By Scott Carlson

代码: 全选

#!/bin/bash
#
# Dump wma to mp3

for i in *.wma
do
if [ -f $i ]; then
rm -f “$i.wav”
mkfifo “$i.wav”
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader “$i” -aofile “$i.wav” &
dest=`echo “$i”|sed -e ’s/wma$/mp3/’`
lame -h -b 192 “$i.wav” “$dest”
rm -f “$i.wav”
fi
done

Do as you would be done by !
回复