How to convert audio.m4a to audio.amr on OS X?

1.9k views Asked by At

I tried installing ffmpeg

$ brew install ffmpeg

and running ffmpeg

$ ffmpeg -i audio.m4a -ar 8000 -ab 12.2k audio.amr

I got the following error:

Automatic encoder selection failed for output stream #0:0. Default encoder for format amr (codec amr_nb) is probably disabled. Please choose an encoder manually. Error selecting an encoder for stream 0:0

I can't figure out how to enable amr_nb.

2

There are 2 answers

1
Tylor Hess On BEST ANSWER

Step 1: Find the AMR install option for ffmpeg Homebrew package

List all install options for ffmpeg Homebrew package:

$ brew info ffmpeg

ffmpeg: stable 3.2.2 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/3.2.2 (239 files, 50.3M) *
Built from source on 2016-12-14 at 17:43:58 with: --with-opencore-amr
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ffmpeg.rb

==> Dependencies
Build: pkg-config ✔, texi2html ✔, yasm ✔
Recommended: lame ✔, x264 ✔, xvid ✔
Optional: chromaprint ✘, fdk-aac ✘, fontconfig ✘, freetype ✘, frei0r ✘, game-music-emu ✘, libass ✘, libbluray ✘, libbs2b ✘, libcaca ✘, libebur128 ✘, libgsm ✘, libmodplug ✘, libsoxr ✘, libssh ✘, libvidstab ✘, libvorbis ✘, libvpx ✘, opencore-amr ✔, openh264 ✘, openjpeg ✘, openssl ✘, opus ✘, rtmpdump ✘, rubberband ✘, schroedinger ✘, sdl2 ✘, snappy ✘, speex ✘, tesseract ✘, theora ✘, two-lame ✘, wavpack ✘, webp ✘, x265 ✘, xz ✘, zeromq ✘, zimg ✘

==> Options
...
--with-opencore-amr
        Enable Opencore AMR NR/WB audio format
...

More concisely:

$ brew info ffmpeg | grep amr

--with-opencore-amr

Step 2: Install ffmpeg using Homebrew install options

$ brew install ffmpeg --with-opencore-amr 

Step 3: Run ffmpeg

$ ffmpeg -i audio.m4a -ar 8000 -ab 12.2k audio.amr
0
Gyan On

AMR codec support is via external libraries.

You can get OS X binaries with those libraries linked from https://evermeet.cx/ffmpeg/. Get the snapshot or nightly build.