2

I am recording audio on the iPhone to a CAF file with kAudioFormatiLBC, the recording works fine.

I want to be able to take a sample and also get it to convert to other formats after I have uploaded it to by ruby on rails webservice.

I am trying to use sox but get:

sox in.caf out.mp3

sox FAIL formats: can't open input file `in.caf': Supported file format but unsupported encoding.

Similar with ffmpeg I get:

Unable to find a suitable output format for 'in.caf'

Any ideas?

Thanks

4

4 回答 4

4

我发现 ffmpeg 会翻译数据格式为 aac 的 caf 文件。我在 iPhone 上以 22050Hz、1 通道的 AAC 格式捕获语音。服务器端我可以使用 ffmpeg 将其转换为 .wav 格式,然后使用 sox 将其转换为 .mp3。

下面显示了在 FreeBSD 下运行的 ffmpeg 的配置。

%ffmpeg -i test_aac_22050_1.caf test_pcm_22050_1.wav
FFmpeg version 0.6.3, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul  7 2011 16:16:19 with gcc 4.2.1 20070719  [FreeBSD]
  configuration: --prefix=/usr/local --mandir=/usr/local/man --enable-shared --enable-    gpl --enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-x11grab --enable-memalign-hack --cc=cc --extra-cflags=-I/usr/local/include/vorbis -I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-pthread --disable-debug --enable-runtime-cpudetect --disable-sse --disable-mmx --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libdirac --enable-libfaac --enable-nonfree --enable-libfaad --enable-libfaadbin --disable-libgsm --disable-libmp3lame --disable-libopenjpeg --enable-libschroedinger --disable-ffplay --disable-libspeex --enable-libtheora --disable-vaapi --disable-vdpau --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Input #0, caf, from 'test_aac_22050_1.caf':
  Duration: 00:00:09.89, start: 0.000000, bitrate: 44 kb/s
    Stream #0.0: Audio: aac, 22050 Hz, mono, s16, 30 kb/s
Output #0, wav, to 'test_pcm_22050_1.wav':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0: Audio: pcm_s16le, 22050 Hz, mono, s16, 352 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=     426kB time=9.89 bitrate= 352.8kbits/s    
video:0kB audio:426kB global headers:0kB muxing overhead 0.010087%

并确认输出:

%file test_pcm_22050_1.wav 
test_pcm_22050_1.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 22050 Hz
于 2011-07-08T06:21:40.403 回答
3

SOX 对用于 CoreAudio 文件处理的 libsndfile 具有可选依赖项。

如果您使用 brew(1) brew install libsndfile在酿造 sox 之前运行。安装 libsndfile 后,您需要重建 sox。

于 2013-11-12T10:03:58.117 回答
0

如果您的服务器运行 OSX,您应该能够使用afconvert. 或者,使用不同的编解码器。

iLBC上的 Wikipedia 文章有一些可能有用的链接。http://ilbcfreeware.org/software.html的顶部链接到 RFC 和用于提取参考源代码的 awk 脚本。

于 2010-06-28T13:25:06.347 回答
0

以下命令对我有用

brew install sox --with-libsndfile

如果你想编码 mp3 你可能还需要

--with-lame
于 2017-02-13T14:07:53.873 回答