#!/usr/bin/env bash # shellcheck disable=SC1004 # shellcheck disable=SC2016 # shellcheck disable=SC2126 set -eux test $# -gt 0 || set -- "${0%/*}"/{old,new}/audio 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 \ -application voip "${0%.*}.opus" && rm -vf "$0" ' {} \;