18 lines
548 B
Bash
18 lines
548 B
Bash
|
#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
|
|||
|
|
|||
|
|
|||
|
# 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%.mp3}.ogg"
|
|||
|
done
|