Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Live RTSP stream will not play with VideoView; No content provider error

I'm new to Android development and can't seem to get anywhere with the development of an app to live stream an RTSP feed from an ip camera. While I can get the code to stream from a website with an RTSP address of a .mov file, I cannot get it to stream from my ip camera's RTSP address. We are using VideoView so that we can support back to android 4.0 because the goal is to display this in Epson Moverio BT-200 video glasses.

Below is the code I have now, with lines to the two streams I can get from the camera commented out. The line not commented out is a test stream online that plays fine.

VideoView videoView;
@Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    //Create a VideoView widget in the layout file
    //use setContentView method to set content of the activity to the layout file which contains videoView
    this.setContentView(R.layout.activity_full_screen_video);
    videoView = (VideoView)this.findViewById(R.id.video_player_view);

    //Set the path of Video or URI
    //videoView.setVideoPath("rtsp://192.168.1.122/h264");
    //videoView.setVideoPath("http://192.168.1.122/ipcam/mjpeg.cgi");
    videoView.setVideoPath("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");

    //Set the focus
    videoView.requestFocus();
    videoView.start();
}

When ran with either of the lines that are pulling from the ip camera, we get the error below:

'setDataSource IOException happend :
java.io.FileNotFoundException: No content provider: http://192.168.1.122/ipcam/mjpeg.cgi'

The RTSP stream from the camera has been verified with another rtsp android app, so I know it's not bad.

Does something have to be done to allow for buffering? The ultimate goal is to get as close to real time live streaming to the app to do video overlay in the glasses. However, we can't even get a basic stream to show up. Any and all advice would be welcome!

like image 582
kfilbrun Avatar asked Dec 18 '14 04:12

kfilbrun


People also ask

How do I watch RTSP streams?

Step 1: Download and install VLC Player from http://www.videolan.org/vlc/. Step 2: Open VLC player and select“Open Network Stream”from the Media menu. Step 3: Type the network URL in the dialog box below, and then click Play to play the video with RTSP stream.

Can you view an RTSP stream with a browser?

A browser cannot play RTSP streams directly, therefore it is necessary to convert the RTSP stream into HTML5 on the WCS server's side.


1 Answers

I can confirm that I'm running into a similar issue.

In my case, I'm using a local network RTSP server to serve a file called camera.ts with the following RTSP URL:

rtsp://macpro.local:8554/camera.ts

It produces a Can't play this video error:

Can't play this video error.

I wanted to see if there was a permissions issue or something so I tried the test RTSP url.

rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

Works fine.

So that means it's not a permissions issue. Might be a network issue so let's see if I can get that same BigBuckBunny movie file playing through my RTSP server.

I downloaded that BigBuckBunny movie, converted it to .mkv and tried that.

rtsp://macpro.local:8554/big_buck_bunny.mkv

Works fine.

So that kinda rules out a permissions issue and rules out a network issue or an issue with my server.

My guess is to start honing in on the file type. Perhaps the .ts filetype is giving it trouble.

.ts file extension.

This is the error message I'm seeing in the logs:

D/MediaPlayer: setDataSource IOException happened : 
    java.io.FileNotFoundException: No content provider: rtsp://macpro.local/camera.ts

But, that might be a Red Herring because if I look at the logs when I try and play the test file, which works, I get the same thing:

D/MediaPlayer: setDataSource IOException happend : 
    java.io.FileNotFoundException: No content provider: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

So let's rule that out and keep looking....

Update: I never did find a solution to this. I abandoned trying to view the RTSP stream and only recorded it using ffmpeg instead, which is all that we required for our presentation demo. If you find out a proper solution or Android adds better support, please post it here.

like image 89
Joshua Pinter Avatar answered Sep 27 '22 17:09

Joshua Pinter