first replace space with "_"
for x in * ; do mv "$x" `echo -n $x | tr " " "_"`; done
second: use sox convert ogg to mp3
for x in *.ogg ; do sox $x `echo $x|awk -F . '{print $1 ".mp3"}'`; done
if you occured this error: sox formats: no handler for file extension `mp3'
you can convert ogg to wav first, then convert wav to mp3
for x in *.ogg ; do sox $x `echo $x|awk -F . '{print $1 ".wav"}'`; done
for x in *.wav ; do lame $x `echo $x|awk -F . '{print $1 ".mp3"}'`; done
If you didn't have lame command, you can install use
"yum -y install lame" on fedora
Mp3 to ogg format
mpg321 input.mp3 -w - | oggenc -o output.ogg -
change all mp3 directory to ogg format in current
for x in *mp3; do mpg321 $x -w - | oggenc -o `echo $x |awk -F . '{print $1 ".ogg"}'` -; done
If you didn't have mpg321 command, you can install use
"sudo yum install mpg321" on fedora
本文介绍如何通过shell命令批量替换文件名中的空格、将OGG格式音频文件转换为MP3格式,并提供了处理MP3到OGG格式转换的方法。针对不同场景,如直接转换失败时提供备用方案,包括先转为WAV再转为MP3的方法。
1042

被折叠的 条评论
为什么被折叠?



