-1

I'm quite new to video streaming and opencv in general. I wanted to stream my computations to another device via rtsp from a raspberry pi 3 using h264. I tried writing to a pipe using popen with ffmpeg to a ffserver anf with vlc creating rtsp servers to stream the content. Unfortunately I have huge lag in the stream, the best I could do was go down to 3 seconds.

Is there any way to achieve this? I'm open to consider other technologies.

Thank you

WisdomPill
  • 720
  • 4
  • 11
  • 25

2 Answers2

1

RTMP is no the best way to achieve low latency (< 5s).

I suggest you to use FFMPEG with pure RTP to stream the video to a RTPS server. Or use directly Gstreamer with Gst-RTSP-server, both are open solutions in C.

Latency will also be impacted by your encoder and the hardware it uses to process.

This question has more information.

Thadeu Melo
  • 947
  • 14
  • 40
  • I used gstreamer pipeline alone with opencv VideoWriter but it was not a standard stream so I used gst-rtsp-server. Here's the links of the solutions. https://stackoverflow.com/questions/45544877/write-in-gstreamer-pipeline-from-opencv-in-python and https://stackoverflow.com/questions/47396372/write-opencv-frames-into-gstreamer-rtsp-server-pipeline – WisdomPill Nov 30 '17 at 10:37
0

I would recommend you to use RTMP instead. Latency can be as low as 100's of milliseconds.

Another thing to consider is that VLC and other clients will introduce a video delay due to internal buffering by the player. Look for the option to not buffer the video and you should be able to shave off a couple of seconds from the video latency.

With ffplay you can try the following:

ffplay --fflags nobuffer rtmp://your.server.ip/path/to/stream -loglevel verbose

If you will transmux to DASH or HLS you can also expect to introduce more latency to the video streaming.

MikeBoss
  • 375
  • 1
  • 9
  • I already tried with a combination of ffserver and ffmpeg using a popen and rawvideo but it consumes a lot of resources and the latency is huge. – WisdomPill Aug 04 '17 at 08:01