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

2

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?

Lvov answered 9/8, 2014 at 6:3 Comment(11)
since it is a mediaplayer, I miss a preprare or prepareasync somewhere before start(). I always needed it.Triglyceride
@SatelliteSD, thanks for the reply. I'm using the VideoView wrapper for MediaPlayer, and, from what I can tell, it takes care of the prepare(). #18599175Lvov
seen this answer? #13292132 And here an explanaiton pf the problem and how VLC overcomes it. fabiensanglard.net/mobile_progressive_playback/index.phpTriglyceride
Thanks again, @SatelliteSD. I had seen mention of that issue, but it didn't make sense without your second link. I'll have to see if I can figure out how to diagnose/code the stated workaround myself. I'll post back when I know.Lvov
@SatelliteSD, this post states that the MOOV header is an issue when streaming files, not live streaming (which is what I'm doing). Thoughts? "In the case of RTSP streams, there is an SDP transaction with the server that provides the metadata required for the player to start playback." mail-archive.com/[email protected]/…Lvov
the only thing I can think of momentarily is, that you may not provide audio? So AudioSystem may desperatly tries to find audio on your stream. Totaly guessed.Triglyceride
The camera has audio capabilities, which I haven't touched yet.Lvov
To rule out HD problems, I tried the second stream (704x576), which gives the same error.Lvov
I got the same results when using my phone. Both are 4.4.2, though different manufacturers.Lvov
Did you solve this problem?Kaylor
@Massimo, it turned out the camera that I bought didn't support the onvif commands that I needed, so I put the project on hold. From the old comments in the accept answer, I think there was a problem with the audio codec on the android device that I was trying to use. Hope that helps.Lvov
L
2

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.

Louvar answered 24/8, 2014 at 15:28 Comment(8)
From what I can tell, the moov stuff is not for live streaming. See the original comments.Lvov
The solution is gonna way down under the covers in the protocol or in the details of AOSP code. The details of the session-negotiation, session-setup that you can see in the protcol example link are probably failing somewhere ( port 4 audio, port 4 video, codecs, Packet-type (UDP v TCP)......... )Louvar
if i were u i would not waste time with RTSP. Try out Web-RTC for a more modern solution to live streamsLouvar
I don't control the feed (it's built into the camera). I just need to consume it.Lvov
I found some code for mediaplayer.cpp, and the method that prints "error (x,y)" is called with a MEDIA_ERROR value. The (100,0) are ext1 ("Media framework error code") and ext2 ("Implementation dependant error code"), respectively. I believe when ext1=100 it is a "MEDIA_ERROR_SERVER_DIED", which could correlate to the message I'm getting of "AudioFlinger server died!". I'll dig around that some more.Lvov
I think the clues in this exchange are leading me in the right direction, namely that the audio codec used (G.711) may not be supported. I have to keep digging - and would appreciate continued help - but SO required the awarding of the bounty.Lvov
if its a missing imple of G.711, you should be able to install the NDK and provide your own codec there. Then you would have to extend / re-implement the player to delegate to that codec on the handler for the audio.Louvar
Let us continue this discussion in chat.Louvar
W
0
  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.
Wretched answered 24/8, 2014 at 9:24 Comment(3)
1. setVideoURI doesn't take a string.Lvov
2. As stated above, I tried the app on my tablet and my phone, with the same results. Bother are android 4.4.2, though different manufacturers.Lvov
3. That video url works fine. I note that this video uses the "MPEG4-Video (mp4v)" codec and is only 176x144. My camera is outputting "H264 - MPEG-4 AVC (part 10) (h264)" at 1920x1080. More ideas, @wffger?Lvov

© 2022 - 2024 — McMap. All rights reserved.