Skip to content

Instantly share code, notes, and snippets.

@kerma
Last active April 20, 2024 07:00
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kerma/c52e93eef3b3e50d7237 to your computer and use it in GitHub Desktop.
Save kerma/c52e93eef3b3e50d7237 to your computer and use it in GitHub Desktop.
Convert all flac files in folder to m4a using ffmpeg and libfdk_aac
# on os x use brew to get ffmpeg with libfdk_aac
brew install ffmpeg --with-fdk-aac
# convert and use m4a as file extension
find . -name '*.flac' -exec sh -c 'ffmpeg -i "$1" -c:a libfdk_aac -b:a 320k "${1%.flac}.m4a"' _ {} \;
@markjaquith
Copy link

Currently, you must do the following to install ffmpeg with libfdk_aac:

brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac

@benfry
Copy link

benfry commented Dec 24, 2020

For me, ffmpeg also reported Could not find tag for codec h264 in stream #0, codec not currently supported in container until I added -map a:0 to specify that there shouldn't be a video track. So the final version looked like this:

find . -name '*.flac' -exec sh -c 'ffmpeg -i "$1" -map a:0 -c:a libfdk_aac -b:a 320k "${1%.flac}.m4a"' _ {} \;

Thanks to both of you for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment