Page 1 of 1

Streaming a webcam with minimal latency

Posted: 24 Nov 2009 20:58
by CalcProgrammer1
I've been working on a "robot" project that consists of a netbook on a wheel base. I want to be able to drive the robot using another laptop and a joystick. I want to be able to use the netbook's internal webcam to send back a video feed to my main laptop. I'm using Video For Linux 2 to capture the webcam, HTTP to stream, and VLC on both computers. I only need video so audio streaming isn't important. I also am using WiFi (locally) so bandwidth should not be an issue. The main issue I'm having is that there is roughly a 5 second lag time between the webcam and the display (on the laptop). The camera is working fine because VLC on the netbook shows it with no lag, so the lag is introduced during the transfer.

I know VLC has options that cache data to improve performance, but I am concerned about seeing what the netbook sees in real time and don't care if the video is slightly choppy. The frame rate seems to be very good whenever I tried it, just the video was delayed. What options (both on the serving PC and the receiving PC) must be changed to eliminate or reduce the lag?

Re: Streaming a webcam with minimal latency

Posted: 25 Nov 2009 18:15
by Rémi Denis-Courmont
VLC may induce approximately 1 second of caching. You can change the HTTP caching value for that. The rest is either not coming from VLC (network error correction?) or is intrinsic.

Re: Streaming a webcam with minimal latency

Posted: 11 Mar 2011 18:56
by norbinus
I have the same problem with a similar robot project. I use the following command to start the webcam streaming and have 3 or 4 secunds latency:

Code: Select all

$ vlc v4l2:// -vvv dev/video0:norm=secam:frequency=543250:size=640x480:channel=0:adev=/dev/dsp:audio=0 --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256,vt=800000,keyint=80,deinterlace}:std{access=http,mux=ts,dst=:8081 http-caching=120}' --ttl 12
I used "http-caching=" but nothing. Maybe the problem is elsewhere in the command, but I don't think network is the problem because i am in LAN with the robot. I hope someone has found solution to this problem, because it is a big one for me. Thanks

Re: Streaming a webcam with minimal latency

Posted: 12 Mar 2011 08:47
by Rémi Denis-Courmont
http caching is on the receiver. But if you transcode, you're going to have high latency. That's hardly avoidable.

Re: Streaming a webcam with minimal latency

Posted: 19 May 2011 03:37
by hussam_2000
I don't know what kind of money are you willing to spend on your robot ( i hope it is a funded project :) ). end to end latency will be huge with VLC running on both ends. i just bought a $3500 encoder and my end to end latency is 200 ms. using the hardware encoder as a sender and VLC as a decoder and I'm also streaming in HD. you cannot reduce the latency that much using software on both ends. i tried this for months without success. Good luck.