processing-video icon indicating copy to clipboard operation
processing-video copied to clipboard

rtsp camera stream 3 seconds delay

Open spiderdab opened this issue 6 years ago • 5 comments

Hi, I really don't know where the issue applies, but in Processing 3.5.3, with this library, using this code:

import processing.video.*;
Movie movie;

void setup() {
  //size(1280, 720, P2D);
  size(640, 360, P2D);
  Movie.supportedProtocols[0] = "rtsp";
  println(Movie.supportedProtocols[0]);
  try {
    movie = new Movie(this,"rtsp://192.168.1.10:554/user=admin&password=1234&channel=1&stream=0.sdp?real_stream");
    movie.play();
  } 
  catch (Exception e) {
    println(e);
  }
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  background(0);
  image(movie, 0, 0, width, height);
}

the video is displayed 3 seconds later, on every resolution, fps or bandwidth i set the camera. this on LinuxMint 19.1 either with the integrated i915 intel graphic card, and the GeForce GTX 850M. The strange thing is that on a windows guest, virtualized on the same host, using CMS software (suggested by the cam manufactor) there is no lag.

Any suggestion? maybe something dealing with buffering?

Thank you.

spiderdab avatar Mar 16 '19 16:03 spiderdab

Hi,

I have exactly the same problem.Have you discovered what happens?

Thank you

pantelisama avatar Aug 01 '19 10:08 pantelisama

Yes, but I don't remember exactly now... With the great help from Neil C.Smith, Author of the fantastic software PraxisLive, I made rtsp work with a good lag (100 ms). The problem with processing-video-library, if I remember correctly, is that it missed the rtspsrc command to set all of the rtsp stream options. Here is the line used into PraxisLive to correctly load the rtsp stream: rtspsrc latency=0 buffer-mode=0 udp-buffer-size=400000 location="rtsp://192.168.1.10:554/user=admin&password=&channel=1&stream=0.sdp?real_stream" ! rtph264depay ! decodebin ! videocrop top=0 bottom=0 the key was: latency=0 buffer-mode=0. Probably the udp-buffer line was useless, I really don't remember..

I wish it can be useful to you. In case please, advice me. Ciao, Davide.

spiderdab avatar Aug 01 '19 14:08 spiderdab

@spiderdab support for custom pipelines is being implemented, and will be fully functional in the upcoming stable release of v2.0

codeanticode avatar Aug 25 '19 14:08 codeanticode

Yes, but I don't remember exactly now... With the great help from Neil C.Smith, Author of the fantastic software PraxisLive, I made rtsp work with a good lag (100 ms). The problem with processing-video-library, if I remember correctly, is that it missed the rtspsrc command to set all of the rtsp stream options. Here is the line used into PraxisLive to correctly load the rtsp stream: rtspsrc latency=0 buffer-mode=0 udp-buffer-size=400000 location="rtsp://192.168.1.10:554/user=admin&password=&channel=1&stream=0.sdp?real_stream" ! rtph264depay ! decodebin ! videocrop top=0 bottom=0 the key was: latency=0 buffer-mode=0. Probably the udp-buffer line was useless, I really don't remember..

I wish it can be useful to you. In case please, advice me. Ciao, Davide.

Hi,

Thanks for the reply.Could you share with us the Praxis live project that worked?

Kind Regards

pantelisama avatar Sep 10 '19 13:09 pantelisama

I've extracted the bare camera-in module that works with my chinese cameras. Unfortunately not every rtsp camera work with the same commands. I succeded with two cameras together on the screen with a good latency.

rtsp_video_in.zip The cameras I'm working with are these

Let me know if that work. Davide.

spiderdab avatar Sep 10 '19 22:09 spiderdab