From 0f69b7ea49aa6595dcd514c03e7f1e05ad656bcd Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Tue, 20 Jan 2026 17:15:17 +0100 Subject: [PATCH] minor fix --- modules/transcode.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/transcode.nix b/modules/transcode.nix index 24c9c24..ee40b81 100644 --- a/modules/transcode.nix +++ b/modules/transcode.nix @@ -8,13 +8,12 @@ programs.zsh.initContent = '' function audio2aac() { local dir="''${1:-.}" - for f in "$dir"/**/*.(flac|mp3|wav|ogg|wma|aiff)(N); do - if [[ -f "$f" ]]; then - local outfile="./transcode/''${f%.*}.m4a" - mkdir -p "$(dirname "$outfile")" - ffmpeg -i "$f" -vn -c:a aac -b:a 256k -movflags +faststart "$outfile" - fi - done + find "$dir" \( -name '*.flac' -o -name '*.mp3' -o -name '*.wav' -o -name '*.ogg' -o -name '*.wma' -o -name '*.aiff' \) -type f -print0 | xargs -0 -P4 -n1 sh -c ' + f="$1" + outfile="./transcode/''${f%.*}.m4a" + mkdir -p "$(dirname "$outfile")" + ffmpeg -i "$f" -vn -c:a aac -b:a 256k -movflags +faststart "$outfile" + ' _ } function video2av1() {