Added default option for multiple audio channels
This commit is contained in:
parent
3005a70e6f
commit
a7f83a231e
1 changed files with 7 additions and 1 deletions
|
@ -28,6 +28,12 @@ echo "extension is $extension"
|
||||||
|
|
||||||
for file in **/*.@($extension); do
|
for file in **/*.@($extension); do
|
||||||
channels=$(ffprobe "$file" -show_entries stream=channels -select_streams a -of compact=p=0:nk=1 -v 0)
|
channels=$(ffprobe "$file" -show_entries stream=channels -select_streams a -of compact=p=0:nk=1 -v 0)
|
||||||
|
streams=$(echo "$channels" | wc -l)
|
||||||
|
if [ streams -gt 1 ]; then
|
||||||
|
echo "Error: Automatic Bitrate is not supported for files with multiple audiostreams. The default bitrate of 128k will be used"
|
||||||
|
channels="2"
|
||||||
|
fi
|
||||||
|
|
||||||
case $channels in
|
case $channels in
|
||||||
1) bitrate="64k";;
|
1) bitrate="64k";;
|
||||||
2) bitrate="128k";;
|
2) bitrate="128k";;
|
||||||
|
@ -37,7 +43,7 @@ for file in **/*.@($extension); do
|
||||||
esac
|
esac
|
||||||
# https://wiki.xiph.org/Opus_Recommended_Settings
|
# https://wiki.xiph.org/Opus_Recommended_Settings
|
||||||
|
|
||||||
ffmpeg -threads 4 -v 0 -i "$file" -c:a libopus -b:a $bitrate "${file%.*}.opus" && rm "$file"
|
ffmpeg -threads 4 -v 0 -i "$file" -map 0 -c:a libopus -b:a $bitrate "${file%.*}.opus" && rm "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue