I have been trying to convert flac to m4a, I have the below script that does the job but it is not recursive:
for f in *.flac; do
ffmpeg -i "$f" -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f%.flac}.m4a"
done
For recursive, I did try several ways but none worked, here is what I tried (space on file name is the problem here)
for f in `find . $PWD -iname *.flac`; do
ffmpeg -i "$f" -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f%.flac}.m4a"
done
and this
find . -type f -iname "*.flac" -print0 |
while IFS= read -r -d $'\0' line; do
echo "$line"
ffmpeg -i "$line" -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f%.flac}.m4a"; done
done
None of them work.