]> Git — Sourcephile - julm/podcasts.git/blob - reencode.sh
init
[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 find "$@" -depth -type f -name "*.mp3" -print0 | sort -n -z |
9 xargs -0 -P "$(lscpu --online -p | grep -v "#" | wc -l)" -I {} bash -c '
10 nice -n 19 ffmpeg -y -i "$0" \
11 -c:a libopus -b:a 64k \
12 -application voip "${0%.*}.opus" &&
13 rm -vf "$0"
14 ' {} \;