]> Git — Sourcephile - julm/podcasts.git/blob - reencode.sh
update
[julm/podcasts.git] / reencode.sh
1 #!/usr/bin/env bash
2 # shellcheck disable=SC1004
3 # shellcheck disable=SC2016
4 # shellcheck disable=SC2126
5 set -eux
6 test $# -gt 0 ||
7 set -- "${0%/*}"/{old,new}/audio
8 #preserveCoverArt="-vcodec copy -f mkv"
9 find "$@" -depth -type f \( -name "*.mp3" -o -name "*.m4a" -o -name "*.audio*" -o -name "*.unknown_video" \) -print0 | sort -n -z |
10 xargs -0 -P "$(lscpu --online -p | grep -v "#" | wc -l)" -I {} bash -c '
11 nice -n 19 ffmpeg -y -i "$0" \
12 -map_metadata 0:s:a:0 \
13 -c:a libopus -b:a 32k \
14 -application voip "${0%.*}.opus" &&
15 rm -vf "$0"
16 ' {} \;
17
18 # -map_metadata 0:s:a:0
19 # copies metadata from the first input file (0:),
20 # first audio stream (s:a:0) to all output files.