Last active
August 30, 2016 16:06
-
-
Save AndyA/6e0ecff6fc3d965b3423540637f10f20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Finds all *.flac files and produces corresponding *.m4a ALAC versions | |
# | |
# Usage: flac2alac <file|dir>... | |
{ | |
for obj in "$@"; do | |
if [ -f "$obj" ]; then | |
echo "$obj" | |
elif [ -d "$obj" ]; then | |
find "$obj" -iname '*.flac' | |
fi | |
done | |
} | while read src; do | |
dst="${src%.*}.m4a" | |
if [ "$src" -nt "$dst" ]; then | |
echo "$src -> $dst" | |
tmp="${src%.*}.tmp.m4a" | |
ffmpeg -i "$src" \ | |
-nostdin \ | |
-vn \ | |
-c:a alac \ | |
-y "$tmp" && mv "$tmp" "$dst" | |
# ffmpeg doesn't exit via SIGINT when it gets SIGINT | |
[ $? == 255 ] && exit | |
fi | |
done | |
# vim:ts=2:sw=2:sts=2:et:ft=sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment