6

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?

4

2 回答 2

2

对您的 logcat 和 RC=100 进行疯狂猜测...没有 SDP 文件或没有用于协商流/容器/编解码器/格式的详细信息所需的“moov atom”块的 RTSP 的等效文件...您可以获得mediaPlayer/videoView 的 AOSP 代码并 grep 源中的 RC 值。

RTSP 难以调试(注意工具链接),并且由于 UDP 问题,不能保证在 NAT 网络内运行。因此,为了获得更好的结果,您可能需要考虑强制您的配置在 TCP 而非 UDP 上执行数据通道。或者可能是其他问题,其中有很多。

如果您真的想进行调查,可以使用以下一些可能的工具:

使用命令行和CURL 客户端请求您的流:

Android - Git 上的 Java RTSP 会话管理包

CLI RTSP 会话到 Youtube RTSP/SDP 流的协议转储

为了解决这个问题,您可能需要使用调试工具来跟踪协议协商的详细信息,该协议协商在 MediaPlayer 实际开始在流上播放之前。这将包括学习RFP和协议细节。

于 2014-08-24T15:28:30.810 回答
0
  1. videoView.setVideoURI(“rtsp://192.1.0.193:554/mpeg4”);
  2. 在另一部手机上试用您的应用。
    您可能会发现问题与移动设备有关。
  3. 试试这个路径:“rtsp://218.204.223.237:554/mo​​bile/1/4C024DFE77DC717D/onnuvesj43xj7t26.sdp”。
    看看代码是否有问题。
于 2014-08-24T09:24:01.137 回答