[英]How to extract audio from live video stream on Red5?
I need to extract audio from a live stream on red5 and stream it separately. 我需要从red5上的实时流中提取音频并将其单独流化。
On nginx with rtmp module I'd just retranslate this stream via ffmpeg without videodata, but I have no idea how to do anything like this (with or without ffmpeg) on Red5. 在带有rtmp模块的nginx上,我只是通过不带视频数据的ffmpeg重新转换此流,但是我不知道如何在Red5上做类似的事情(带或不带ffmpeg)。
The first link on google gave me this: 谷歌的第一个链接给了我这个:
just register IStreamListeners on your IClientStreams, and then separate AudioData from VideoData in the RTMPEvents 只需在IClientStreams上注册IStreamListener,然后在RTMPEvents中将AudioData与VideoData分开
But this doesn't help much. 但这并没有太大帮助。 To be honest, this doesn't help at all. 老实说,这根本没有帮助。 What are these IStreamListeners and how do I register them on IClientStream ? 这些IStreamListener是什么,如何在IClientStream上注册它们?
And, what is more misterious, how do I separate AudioData from VideoData in some RTMPEvents? 而且,更不可思议的是,如何在某些RTMPEvent中将AudioData与VideoData分开?
This is how your extend RTMPClient and capture the Audio or Video events 这是扩展RTMPClient并捕获音频或视频事件的方式
private class TestClient extends RTMPClient { private int audioCounter; private int videoCounter; public void connect() { private IEventDispatcher streamEventDispatcher = new IEventDispatcher() { public void dispatchEvent(IEvent event) { System.out.println("ClientStream.dispachEvent()" + event.toString()); String evt = event.toString(); if (evt.indexOf("Audio") >= 0) { audioCounter++; } else if (evt.indexOf("Video") >= 0) { videoCounter++; } } }; } }
This simply counts the a/v events, but it will get you part of the way there. 这只是计算音频/视频事件,但它将使您参与其中。 I suggest looking though the unit tests in red5 and there you can learn a lot. 我建议您看一下red5中的单元测试,在那里您可以学到很多东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.