Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to remove lag from RTSP stream playing in a VideoView on Android
    primarykey
    data
    text
    <p>My goal is to have a computer stream the video from a usb webcam to my own android app.</p> <p>On the PC I'm running VLC which streams the capture device (webcam) over RTSP on port 8554, with the following settings:</p> <pre><code>Video Codec: H.264 Video Resolution: 1600x1200 x 0.25= 400 x 300 px Video Frame Rate: 12 fps Video Bitrate: 56 Kbps and NO audio </code></pre> <p>I picked very low settings to see if it would improve lag but had little to no effect on lag. This is the generated output stream string VLC gives me:</p> <pre><code>:sout=#transcode{vcodec=h264,vb=56,fps=12,scale=0.25,acodec=none}:rtp{sdp=rtsp://:8554/} :sout-keep </code></pre> <p>On android side in the onCreate Method I have:</p> <pre><code>String url = "rtsp://192.168.1.103:8554/"; vid = (VideoView) findViewById(R.id.videoView1); mc = new MediaController(this); vid.setMediaController(mc); vid.setVideoURI(Uri.parse(url)); vid.requestFocus(); vid.setOnPreparedListener(new OnPreparedListener(){ @Override public void onPrepared(MediaPlayer mp) { // TODO Auto-generated method stub vid.start(); } }); </code></pre> <p>Results:</p> <p>When the app loads up VideoView is all black for about 10-20 seconds while two messages pop up in LogCat:</p> <pre><code>Tag Text MediaPlayer Couldn't open file on client side, trying server side MediaPlayer getMetadata </code></pre> <p>once the video is displayed, there's about 20 seconds of lag and after about 30-60 seconds the video remains frozen. These messages also come up once the video starts playing:</p> <pre><code>Tag Text MediaPlayer info/warning (3, 0) MediaPlayer Info (3, 0) </code></pre> <p>I also tried capturing the stream from another PC on the same network with VLC, it seems that the lag is still there as well however it never freezes. Not sure whether I should use a different RTSP server, such as Darwin? use a different protocol, HTTP or RTP? or if something needs to be changed on the android side?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload