Search code examples
audioffmpegwavm4a

Batch convert wav to m4a files using ffmpeg


I'm trying to batch convert thousands of wav files into 96k m4a files on Mac OS Mojave using ffmpeg in the terminal.
I'm trying to use the following code:
for f in *.wav; do ffmpeg -i "$f" -c:a libfdk_aac -b:a 96k “${f%.wav}.m4a”; done
I'm being given the following error:
Unable to find a suitable output format for '“file.m4a”' “file.m4a”: Invalid argument
Can anyone help?


Solution

  • Smartquotes are treated as part of the filename. Use plain quotes instead:

    for f in *.wav; do ffmpeg -i "$f" -c:a libfdk_aac -b:a 96k "${f%.wav}.m4a"; done