#bash convert.sh # convert all mp3 files to ogg files under the same directory # command example: ffmpeg -i input.mp3 -c:a libvorbis -qscale:a 5 output.ogg # ffmpeg -i "c02_吕萍_01_梦楼.mp3" -c:a libvorbis -qscale:a 8 "./ogg/c02_吕萍_01_梦楼.ogg" # makdir ogg if not exist if [ ! -d "./ogg" ]; then mkdir ogg fi # clear the ogg directory rm -rf ./ogg/* # convert all mp3 files to ogg files for file in *.mp3 do # put the output files to the ./ogg directory # the quality range is from 0–10, where 10 is the highest quality and 3–7 are a good range to try ffmpeg -i "$file" -c:a libvorbis -qscale:a 8 "./ogg/${file}.ogg" done