使用AVPlayer的MTAudioProcessingTap和远程URL进行AVFoundation音频处理 [英] AVFoundation audio processing using AVPlayer's MTAudioProcessingTap with remote URLs

查看:121
本文介绍了使用AVPlayer的MTAudioProcessingTap和远程URL进行AVFoundation音频处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于 AVAudioMix的文档很少和MTAudioProcessingTap,允许将处理应用于AVFoundation(在iOS上)的媒体资产的音轨(PCM访问)。这个文章和简短的提及WWDC 2012会议就是我所找到的。

There is precious little documentation on AVAudioMix and MTAudioProcessingTap, which allow processing to be applied to the audio tracks (PCM access) of media assets in AVFoundation (on iOS). This article and a brief mention in a WWDC 2012 session is all I have found.

我已经设置了描述这里为本地媒体文件工作,但它似乎不适用于远程文件(即HLS流式URL)。预期这一点的唯一迹象是本 Technical Q& A

I have got the setup described here working for local media files but it doesn't seem to work with remote files (namely HLS streaming URLs). The only indication that this is expected is the note at the end of this Technical Q&A:


AVAudioMix仅支持基于文件的资产。

AVAudioMix only supports file-based assets.

有人知道更多吗?当资产不是基于文件时,真的无法访问音频PCM数据吗?任何人都可以找到与MTAudioProcessingTap相关的实际Apple文档吗?

Does any one know more about this? is there really no way of accessing the audio PCM data when the asset is not file based? Can anyone find actual Apple documentation relating to MTAudioProcessingTap?

推荐答案

我注意到很多人在互联网上询问这个问题,而且普遍的共识似乎是它不是不可能。

I've noticed quite a few people asking about this around the internet, and the general consensus seemed to be that it wasn't possible.

原来它是 - 我正在研究这个最近的个人项目,并确定MITudioProcessingTap确实可以使用远程流。诀窍是KVObserve AVPlayerItem的状态;当它准备好播放时,你可以安全地检索底层的AVAssetTrack并在其上设置一个AudioMix。

Turns out it is - I was looking into this for a recent personal project and determined that it is indeed possible to make MTAudioProcessingTap work with remote streams. The trick is to KVObserve the status of the AVPlayerItem; when it's ready to play, you can safely retrieve the underlying AVAssetTrack and set an AudioMix on it.

我在这里用一些(主要是工作的)代码做了一个基本的写法:< a href =http://venodesigns.net/2014/01/08/recording-live-audio-streams-on-ios/ =nofollow> http://venodesigns.net/2014/01/08 / recording-live-audio-streams-on-ios /

I did a basic writeup with some (mostly working) code here: http://venodesigns.net/2014/01/08/recording-live-audio-streams-on-ios/

如果你已经成功处理了这个问题,那么你就会有更多的权力,但我想我回答这个问题,因为谷歌很快就会出现这个问题。

If you already managed to handle this, more power to you, but I figured I'd answer this question since it comes up pretty quickly in Google for this stuff.

这篇关于使用AVPlayer的MTAudioProcessingTap和远程URL进行AVFoundation音频处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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