From 6f8154153d159e1243f7fe84dc8a8e84999fd4c4 Mon Sep 17 00:00:00 2001 From: esche Date: Fri, 7 Jul 2023 22:01:04 +0200 Subject: [PATCH] code cleanup --- to_opus.sh | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/to_opus.sh b/to_opus.sh index d7cef48..c06c518 100644 --- a/to_opus.sh +++ b/to_opus.sh @@ -39,39 +39,31 @@ for file in **/*.@($extension); do # array over the number of channels of all streams readarray -t channels <<<"$(ffprobe -v error -select_streams a -show_entries stream=channels -of compact=p=0:nk=1 "$file")" # array over the bitrates of all streams - readarray -t bitrate <<<"$(ffprobe -v error -select_streams a -show_entries stream=bit_rate -of compact=p=0:nk=1 "$file")" + readarray -t bitrates <<<"$(ffprobe -v error -select_streams a -show_entries stream=bit_rate -of compact=p=0:nk=1 "$file")" # number of audiostreams audiostreams=${#channels[@]} - # check if it contains video streams (Thumbnails etc. will be ignored) - isvideo=$(ffprobe -v error -select_streams V -show_entries stream=codec_type "$file") - use_mkv="false" - command="ffmpeg -i \"$file\"" - - # use mkv, if multiple audiostreams exists or it is a videofile - if [[ ${#channels[@]} -gt 1 || -n "$is_video" ]]; then - command="$command -map 0 -map -0:d -c copy -c:a libopus" - use_mkv="true" - fi # set a channel dependend bitrate for every audio stream # https://wiki.xiph.org/Opus_Recommended_Settings # to use ffmpegs default just comment out this block + bitrate_settings="" for ((index=0; index