set -eux
test $# -gt 0 ||
set -- "${0%/*}"/{old,new}/audio
+#preserveCoverArt="-vcodec copy -f mkv"
find "$@" -depth -type f -name "*.mp3" -print0 | sort -n -z |
xargs -0 -P "$(lscpu --online -p | grep -v "#" | wc -l)" -I {} bash -c '
nice -n 19 ffmpeg -y -i "$0" \
- -c:a libopus -b:a 64k \
+ -map_metadata 0:s:a:0 \
+ -c:a libopus -b:a 32k \
-application voip "${0%.*}.opus" &&
rm -vf "$0"
' {} \;
+
+# -map_metadata 0:s:a:0
+# copies metadata from the first input file (0:),
+# first audio stream (s:a:0) to all output files.