如何在 OS X 上将 audio.m4a 转换为 audio.amr?

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

我试过安装 ffmpeg

$ brew install ffmpeg

和运行 ffmpeg

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

我收到以下错误:

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

我不知道如何启用 amr_nb。

AMR 编解码器支持是通过外部库实现的。

您可以获得 OS X 个二进制文件以及从 https://evermeet.cx/ffmpeg/ 链接的那些库。获取快照或每晚构建。

第 1 步:找到 ffmpeg Homebrew 包的 AMR 安装选项

列出 ffmpeg Homebrew 包的所有安装选项:

$ 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
...

更简洁:

$ brew info ffmpeg | grep amr

--with-opencore-amr

第 2 步:使用 Homebrew 安装选项安装 ffmpeg

$ brew install ffmpeg --with-opencore-amr 

第 3 步:运行ffmpeg

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