本文介绍了在AVPlayer中录制来自当前播放视频的流音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

许多相似的问题,但不完全相同.

Many similar questions but not Exactly the same.

我目前已经设置了代码,可以通过AVPlayer播放视频.

I currently have my code setup to play video via an AVPlayer.

我想要做的是以某种方式提取流视频的音频,并最终与Mic Input合并(使用AVAudioMixer?). (例如Karaoke应用程序),因此当用户播放录音时,它将仅播放视频中的音频和麦克风中的录音.

What I'm wanting to do is somehow extract the audio of the streaming video and eventually merge with the Mic Input (using AVAudioMixer?). (think Karaoke app) so when the user plays the recording it will play back the audio only from the video and the recording from the mic.

我认为AVAudioEngine是必经之路,但我无法终生解决.

I think AVAudioEngine is the way to go but i cannot for the life of me work it out.

所以我的问题是我该如何从AVPlayer中当前播放的视频中提取或录制音频,重要的是如何与在线源(youtube)进行流传输.

So my question is how do i extract or record the audio from the currently playing video in AVPlayer and importantly which is streaming with an online source (youtube).

提出该问题的另一种方法如下

Another way to ask the question could be as follows

我有一个广播应用程序,(想想tuneIn Radio),我想录制流音频.

I have a radio application and (think tuneIn Radio) and i want to record the streaming audio.

推荐答案

一个来源建议您同时启动AVPlayerAVAudioRecorder时,听听音频路由的变化.想法是使用AudioSessionAddPropertyListener(...)并监视kAudioSessionProperty_AudioRoute音频路由,然后在收到AVPlayer路由时开始录音.

One source suggests you listen for audio routing changes when the AVPlayer and AVAudioRecorder are started at the same time. The idea is to use AudioSessionAddPropertyListener(...) and monitor kAudioSessionProperty_AudioRoute audio routes, then start the recording when you receive the AVPlayer route.

REF:使用AVPlayer播放视频并录制声音同时使用AVAudioRecorder

另一种解决方案是使用MTAudioProcessingTap( ref ),使用KVObserving设置流处理程序,并记录流式视频的音频通道.

Another solution is to use MTAudioProcessingTap (ref), set up a stream handler using KVObserving, and record your streaming video's audio channel.

REF:在iOS上录制实时音频流

另一种解决方案是仅与委托进行类别为AVAudioSessionCategoryPlayAndRecord的音频会话,并在开始播放视频后启动音频记录.

Another solution is to just start an audio session of category AVAudioSessionCategoryPlayAndRecord with a delegate, and initiate the audio recording after you have started playing the video.

REF:

REF: how can i record a song which is playing with AVPlayer and an wav file at a same time?

这篇关于在AVPlayer中录制来自当前播放视频的流音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 21:04