RTSP 1080p live-streaming android client gets error (100,0)

我是研究僧i 提交于 2019-12-06 00:27:47

问题


My new surveillance camera just arrived, so I'm trying to write an app to live stream the video from it.

Since it came with basically no documentation, I installed the 'onvifer' android app which allows you to browse the camera's capabilities. This app works fine - gets the video and allows PTZ controls, etc. It reports the streaming url as:

 rtsp://192.1.0.193:554/mpeg4

I tested the stream in the VLC windows client, and it's able to stream video from that URL as well. This makes me comfortable that the network is working OK.

The camera states the feed will be 1920x1080; VLC confirms this.

The basic code in my activity:

VideoView videoView = (VideoView)this.findViewById(R.id.VideoView);
videoView.setVideoURI(Uri.parse("rtsp://192.1.0.193:554/mpeg4"));
videoView.requestFocus();
videoView.start();

I've also given the app INTERNET permissions in AndroidManifest.xml, disabled authentication on the camera, and am running on a real device (not the emulator).

When I run the app, LogCat shows this immediately:

setDataSource IOException happend :
java.io.FileNotFoundException: No content provider: rtsp://192.1.0.193:554/mpeg4
at android.content.ContentResolver.openTypedAssetFileDescriptor (ContentResolver.java).

About 15 seconds later, the app shows a "Can't play this video" modal dialog box and this is added to LogCat:

MediaPlayer      error (100, 0)
AudioSystem      AudioFlinger server died!
MediaPlayer      error (100, 0)
VideoView        Error: 100,0

I've googled everything I can think of, but haven't found anything useful.

Any thoughts?


回答1:


wild-ass-guess on your logcat and the RC=100... No SDP file or no equivalent for RTSP of the 'moov atom' block required to negotiate details of the stream /container/ codec/ format... You can get the AOSP code for mediaPlayer/videoView and grep the RC value in the source.

RTSP is gnarly to debug ( note the tools links ) and not assured to run inside a NAT'd network due to UDP issues. So, to get better result, you may have to look into forcing your config to do data channel on TCP an not UDP. Or it could be other issues , of which there are many.

If you really want to investigate, some possible tools below:

Use command line and CURL client to request your stream:

Android - Java RTSP Session Mgmt package on Git

Protocol dumps for CLI RTSP sessions to Youtube RTSP/SDP streams

To pursue the issue, you may need to get into the weeds with debug tools that track details of the protocol negotiation that preceeds the MediaPlayer actually starting play on the stream. That would include learning the RFP and the protocol details.




回答2:


  1. videoView.setVideoURI(“rtsp://192.1.0.193:554/mpeg4”);
  2. Try your app on another phone.
    You may find the problem is about the mobile device.
  3. Try this path:"rtsp://218.204.223.237:554/mobile/1/4C024DFE77DC717D/onnuvesj43xj7t26.sdp".
    See whether the code has something wrong.


来源:https://stackoverflow.com/questions/25215724/rtsp-1080p-live-streaming-android-client-gets-error-100-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!