简体   繁体   English

从AIFF转换的AVAudioPlayer M4A文件产生的延迟不同于从ADTS AAC转换的M4A

[英]AVAudioPlayer M4A file converted from AIFF produces different latency than M4A converted from ADTS AAC

While working on a rhythm music game, I noticed that AVAudioPlayer has a latency between the reported .currentTime and the actual location within an audio file, that varies according to the file format. 在制作节奏音乐游戏时,我注意到AVAudioPlayer在报告的.currentTime与音频文件中的实际位置之间存在延迟,该延迟根据文件格式而有所不同。

For instance, playing an .m4a file will produce lower latency than playing an .aac file (ADTS AAC). 例如,播放.m4a文件将比播放.aac文件(ADTS AAC)产生更低的延迟。

That's somewhat understandable and I came to accept this already (as the latency was a constant according to file type). 这有点可以理解,我已经接受了这一点(因为延迟是根据文件类型而定的)。

What I don't understand, is why these different latencies might also happen for 2 kinds of .m4a files, those converted from an original AIFF file, and those first converted to ADTS AAC and then converted to .m4a 我不明白的是,为什么对于2种.m4a文件,从原始AIFF文件转换的文件,以及先转换为ADTS AAC然后转换为.m4a的文件,也会发生这些不同的延迟的原因

In other words: 换一种说法:

If I run: 如果我运行:

afconvert -f m4af -d aac my_aif_file.aif

I get a file playing in lower latency than a file that was created like this: 我得到的文件播放的延迟比这样创建的文件低:

afconvert -f adts -d aac my_aif_file.aif
afconvert -f m4af -d aac my_aif_file.aac

Any explanation/solution to understand these different outcomes will be appreciated. 任何理解这些不同结果的解释/解决方案将不胜感激。

Found the issue - it's the conversion itself. 找到了问题-就是转换本身。

When converting to adts aac the converted audio has a prefix of about 40ms of silence... Weird... 转换为adts aac时,转换后的音频具有约40ms的静音前缀...很奇怪...

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

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