AVFoundation audio processing using AVPlayer MTAudioProcessingTap with remote URLs

AVAudioMix and MTAudioProcessingTap have a little documentation that allows you to process processing for audio tracks (PCM access) to media assets in AVFoundation (on iOS). This article and a brief mention at the WWDC 2012 session is all I found.

I have the setup described here that works for local media files, but it doesn’t work with remote files (namely HLS HTTP streams). The only sign that this was expected is the note at the end of this Technical Q & A :

AVAudioMix only supports file-based files.

Does anyone know more about this? Is there no way to access PCM audio data when the object is not file based? Can anyone find the actual Apple documentation related to MTAudioProcessingTap?

+6
source share
1 answer

I noticed quite a few people who asked about it on the Internet, and the general consensus seemed to be that this was impossible.

Turns out this is - I was studying this for a recent personal project and decided that it really was possible to get MTAudioProcessingTap to work with remote threads. The trick is KVObserve AVPlayerItem status; when it is ready for playback, you can safely extract the base AVAssetTrack and install AudioMix on it.

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

If you have already managed to deal with this, you have more strength, but I decided that I would answer this question, since it is pretty fast on Google.

+3
source

Source: https://habr.com/ru/post/946172/


All Articles