Lame压缩mp3文件
#!/bin/bash
#colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
#total number of mp3
exts=(*.mp3)
count=${#exts[@]}
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for file in $(ls *.mp3)
do
printf "${GREEN} There are ${count} files to process!\n"
name=${file%%.mp3}
#to see if there is aready a compressed version
compname=${name}_compressed.mp3
if [ -f "$compname" ]
then
printf "${GREEN}There is aready has a compressed version of ${RED}$name\n${NC}"
rm "${name}.mp3"
continue # we just delete the duplicated file
fi
if [[ "$name" == *"compressed"* ]]
then
printf "${RED}$name ${GREEN}is already compressed\n${NC}"
else
printf "${GREEN}Ready to compress ${RED}$name\n${NC}"
lame -V9 -h --vbr-new ${name}.mp3 ${name}_compressed.mp3
rm "$name.mp3"
fi
count=$[${count}-1]
done
IFS=$SAVEIFS
本作品采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循署名-非商业用途-保持一致的创作共用协议.

发表回复