问题描述
我的要求是要能在我的Android应用程序播放实时视频流。流将超过RTSP / RTP。我不具备源无法控制;它看起来像RTP有效载荷不符合开发者指南中的要求视频编码建议的。具体地讲,下面的要求似乎由视频源被侵犯:
基本上,它看起来像我们得到的原始数据H264(不是裹着一个容器)。
现在,
- 在我无法播放使用
的MediaPlayer
类此流在Android 2.2三星Galaxy Tab。 - 不过,我能发挥它在Android 2.3三星Galaxy S。
- 某些第三方应用程序(MX播放器)能够起到对2.2的Galaxy Tab相同的流为好。
在这两种情况下2和3所述,DDMS日志指出这样的事实,怯场框架正在内部使用,而在情况1中,PVP(即的OpenCore)中被使用。所有这一切使我得出这样的结论:
- 我流不能由框架的OpenCore播放。
- 在我的流可以使用Stagefright播放 - 即使是在Android 2.2
这让我想起了我的问题:
另外,我注意到,在AOSP源较新的 NuPlayer
负责播放RTSP流了。问:
我知道我可以检查出的来源和使用NDK构建stagefright和NuPlayer(虽然我从来没有在NDK级)。我不知道是我的应用程序如何可以使用这个NuPlayer。
我卡住了类似的问题,但我已经找到一个解决方案。需要修补系统build.prob文件。请看看我的问题,我也张贴了我的answer.
在默认情况下stagefright保持禁用build.prop文件。你必须启用它并重新启动您的设备。然后你就可以访问stagefright框架,它不支持您的要求。
有关在远程机TEST RTSP流媒体下载live555MediaServer.exe文件,并保存在同一个位置的一些媒体文件。打开live555MediaServer.exe文件。
使用下面的code -
私有最终字符串RTSP_FILE =rtsp://形式<远程计算机的IP> /<文件名>中;
mVideoView.setVideoURI(Uri.parse(RTSP_FILE));
My requirement is to be able to play a live video stream in my Android app. The stream will be over RTSP/RTP. I have no control over the source; and it looks like the RTP payload does not meet the requirements outlined in the Developers Guide Video encoding recommendations. Specifically, the following requirement seems to be violated by the video source:
Basically, it looks like we get raw H264 data (not wrapped in a container).
Now,
- I was not able to play this stream using the
MediaPlayer
class on an Android 2.2 Samsung Galaxy Tab. - However, I was able to play it on an Android 2.3 Samsung Galaxy S.
- Some third-party apps (MX Player) were able to play the same stream on the 2.2 Galaxy Tab as well.
In both cases 2 and 3 above, the DDMS logs pointed to the fact that Stage Fright framework was being used internally, while in case 1, PVP (i.e, OpenCore) was being used. All this leads me to conclude that:
- My stream cannot be played by OpenCore framework.
- My stream can be played using Stagefright - even on Android 2.2
Which brings me to my question:
Further, I noticed in the AOSP source that the newer NuPlayer
is responsible for playing RTSP streams now. Question:
I am aware that I can check out the sources and use NDK to build stagefright and NuPlayer (although I have never worked at the NDK level). What I don't know is how my app can then use this NuPlayer.
I'm stuck similar problem, but I've found one solution. You have to patch system build.prob file. Please have a look my question and also I posted my answer.
By default stagefright is kept disable in build.prop file. You have to enable it and reboot your device. Then you can access stagefright framework which does support your requirements.
For RTSP streaming download live555MediaServer.exe file in your remote mechine and keep some media file in same location. Open live555MediaServer.exe file.
Use the following code -
private final String RTSP_FILE = "rtsp://<remote machine IP>/<file name>";
mVideoView.setVideoURI(Uri.parse(RTSP_FILE));
这篇关于反向移植stagefright和NuPlayer至Android 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!