xiandie/asset/audio/peiyin/convert.sh

22 lines
650 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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 010, where 10 is the highest quality and 37 are a good range to try
ffmpeg -i "$file" -c:a libvorbis -qscale:a 8 "./ogg/${file%.mp3}.ogg"
done