简体   繁体   English

为什么iOS上的Codename One将音频记录为CAF?

[英]Why is Codename One on iOS recording audio as CAF?

My question is related to this other SO question . 我的问题与另一个SO问题有关 I am trying to record audio in iOS via Capture.captureAudio() . 我正在尝试通过Capture.captureAudio()在iOS中录制音频。 It outputs an audio file that can be read on the computer but neither on iOS (iPhone 4S) nor on Android. 它输出的音频文件可以在计算机上读取,但不能在iOS(iPhone 4S)和Android上读取。

ffmpeg -i yields : ffmpeg -i产生:

Input #0, caf, from 'myFile.m4a':
Duration: 00:00:07.04, start: 0.000000, bitrate: 37 kb/s
Stream #0:0: Audio: aac (aac  / 0x20636161), 16000 Hz, mono, s16, 23 kb/s

If I record a file with iOS via Voice Recorder app I get from ffmpeg : 如果我通过录音机应用程序使用iOS录制文件,我将从ffmpeg获得:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Test.m4a':
Metadata:
major_brand     : M4A 
minor_version   : 0
compatible_brands: M4A mp42isom
creation_time   : 2017-04-03 19:01:32
date            : 2017-04-03T21:01:09+0200
encoder         : com.apple.VoiceMemos (iPhone OS 7.1.2)
Duration: 00:00:05.15, start: 0.000000, bitrate: 67 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, s16, 64 kb/s
  Metadata:
  creation_time   : 2017-04-03 19:01:32
  handler_name    : Core Media Audio

This file can be played on Android and iOS. 该文件可以在Android和iOS上播放。

Although at first sight the mime types seem to be restrained to "amr" 尽管乍看之下,哑剧类型似乎仅限于“ amr”

    /**
 * Gets the available recording MimeTypes
 */ 
public String [] getAvailableRecordingMimeTypes(){
    return new String[]{"audio/amr"};
}

a glance at the native code shows that on iOS it records as "MPEG4AAC" 16kHz. 一眼看一下本机代码 ,就可以看到它在iOS上记录为“ MPEG4AAC” 16kHz。

Consequently why do I get a caf file that cannot be played on mobile ? 因此,为什么我会得到无法在移动设备上播放的caf文件?

Any help appreciated! 任何帮助表示赞赏!

caf files are Core Audio Format files. caf文件是核心音频格式文件。 They are just a wrapper that apple uses for its audio as it has some advantages to storing the audio "unwrapped". 它们只是苹果为其音频使用的包装器,因为它具有存储“未包装”的音频的一些优点。

The audio inside the caf wrapper is still encoded using the format that you specified. caf包装器内的音频仍使用您指定的格式进行编码。 Since it is just a wrapper, it should be fast and easy to "unwrap" it. 由于它只是包装器,因此“包装”起来应该很快且容易。 This google search for "convert caf to mp4" shows lots of results. 这个谷歌搜索“将caf转换为mp4”显示了很多结果。 If you are looking to do it programmatically, appropriate Google searches should yield lots of results. 如果您希望通过编程方式进行搜索,那么适当的Google搜索应会产生很多结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM