I got that find line originally from this superuser.com answer, so if you have an account there, give that guy an upvote.
I would use regular expressions for finding multiple file extensions, something like:
Code:
find . -type f -regextype posix-extended -regex ".*flac|.*wav|.*aiff" -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 4 "${0%.*}.mp3"' '{}' \;
## or (slightly more concise, easier to add more file extensions):
find . -type f -regextype posix-extended -regex ".*\.(flac|wav|aiff)" -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 4 "${0%.*}.mp3"' '{}' \;
You may have to escape the '|'s, unfortunately my linux computer has suffered physical damage & I'm stuck on Windows 8 til Tuesday, so I'm unable to test if this exact syntax works. Check out the find manpage, I guess. You can also use something like:
Code:
find . -type f -name "*.flac" -o -name "*.wav" -o -name "*.aiff" -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 4 "${0/%flac/mp3}"' '{}' \;
...but I prefer the regex way, since it's more concise.
You can also use '-iregex' instead of '-regex' (or '-iname' instead of '-name') to get case-insensitive matches - so it would match both 'whatever.wav' and 'whatever.WAV'
Bookmarks