Page 1 of 1

Reduce delay/lag when streaming from stdin to http ...?!

Posted: 24 Oct 2013 10:53
by alex0801
Hi there,

I have a Raspberry Pi with a Raspberry Pi Camera Board.

I'm streaming h264 video like this:

Code: Select all

raspivid -w 1280 -h 720 -b 2000000 -o - -t 300000000 -fps 25 | cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
raspivid is a command line tool to create h264 encoded video. The argument "-o -" put's the video data to stdout. In this case with 1280x720@25fps and 2Mpbs.

The goal is to have a http h264 stream, which I can decode with VLC on desktop computers as well as with an own App on Android.

Now the problem is: Directly after starting the stream and connecting to it, I get a delay of about 1sec. The longer the stream runs, the bigger the delay gets...
CPU load is <10%.

If I pipe the video data instead to gstreamer, I get a delay of <0,5sec.. But with Full-HD resolution! (see this solution: http://pi.gbaman.info/?p=150). This proofes that the raspivid tool is not causing the delay. Must be VLC :-(

So, back to the "pipe to VLC" solution: I also tried to reduce the http-caching on client side. But this does not really lower the delay. It's still about 1sec and gets bigger and bigger the longer the stuff runs (2-4sec after 20min or so).

Now my question: How do I tweak my command line to reduce the delay as low as possible?

br,
Alex

P.S. Using VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e) on Raspbian Wheezy on Raspberry Pi ARM hardware.

Re: Reduce delay/lag when streaming from stdin to http ...?!

Posted: 05 Nov 2013 20:45
by Jean-Baptiste Kempf
Reduce VLC input and streaming caching.

Re: Reduce delay/lag when streaming from stdin to http ...?!

Posted: 06 Nov 2013 15:43
by Adamski11
I've found exactly the same problem. Reducing the resolution and fps helps a bit but there's still far to much lag to use for real time viewing (e.g. where you remotely control camera movement) and in my testing the same problem of an increasing delay over time even with lower settings. This is a real shame as there doesn't appear to be a solution I can find to this problem other than using gstreamer which has its own problems especially with viewers for all platforms

Re: Reduce delay/lag when streaming from stdin to http ...?!

Posted: 03 Dec 2013 20:16
by Rita VLC
Apart from reducing the VLC input and streaming caching, there seems to be no solution to the time lag. Maybe , it's something the developers can look into.

Re: Reduce delay/lag when streaming from stdin to http ...?!

Posted: 17 Dec 2013 03:44
by yileku
I am streaming from a Raspberry Pi using raspivid piped to clvc. The latency is about 6 seconds. I am interested in getting less than a second latency. I am using vlc 2.1.2 player for mac os x. I don't see anyplace to set the cache size. Any help is appreciated.
Y-

Re: Reduce delay/lag when streaming from stdin to http ...?!

Posted: 14 Apr 2015 22:51
by kielbasa
I'm using the latest version of VLC 2.1.5 and I'd like to increase delay of a streamed video (to 7sec i.e.)
I read that I could tweak caching under codecs/RTS option, but looks like this option is no longer there.

Is there any way of doing it in a different way?
It's for our coach so that he could watch the volleyball action live first, and then to be able to see it on tablet again.