为什么iOS上的Codename One将音频记录为CAF? [英] Why is Codename One on iOS recording audio as CAF?

查看:70
本文介绍了为什么iOS上的Codename One将音频记录为CAF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与此其他相关这样的问题.我正在尝试通过Capture.captureAudio()在iOS中录制音频.它输出一个音频文件,该文件可以在计算机上读取,但不能在iOS(iPhone 4S)和Android上读取.

My question is related to this other SO question. I am trying to record audio in iOS via Capture.captureAudio(). It outputs an audio file that can be read on the computer but neither on iOS (iPhone 4S) nor on Android.

ffmpeg -i产生:

ffmpeg -i yields :

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

如果我通过录音机应用程序在iOS上录制文件,我会从ffmpeg获得:

If I record a file with iOS via Voice Recorder app I get from 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

此文件可以在Android和iOS上播放.

This file can be played on Android and iOS.

尽管乍看之下,哑剧类型似乎仅限于"amr"

Although at first sight the mime types seem to be restrained to "amr"

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

原生代码显示在iOS上记录为16kHz的"MPEG4AAC".

a glance at the native code shows that on iOS it records as "MPEG4AAC" 16kHz.

因此,为什么我得到的caf文件无法在移动设备上播放?

Consequently why do I get a caf file that cannot be played on mobile ?

任何帮助表示赞赏!

推荐答案

caf文件为

caf files are Core Audio Format files. They are just a wrapper that apple uses for its audio as it has some advantages to storing the audio "unwrapped".

caf包装器内的音频仍使用您指定的格式进行编码.由于它只是包装器,因此包装"起来应该很快且容易. 此Google搜索将caf转换为mp4" 显示了很多结果.如果您希望通过编程方式进行搜索,那么适当的Google搜索应会产生很多结果.

The audio inside the caf wrapper is still encoded using the format that you specified. 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. If you are looking to do it programmatically, appropriate Google searches should yield lots of results.

这篇关于为什么iOS上的Codename One将音频记录为CAF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆