Streaming a webcam with minimal latency

About encoding, codec settings, muxers and filter usage
CalcProgrammer1
New Cone
New Cone
Posts: 4
Joined: 24 Apr 2007 22:00

Streaming a webcam with minimal latency

Postby CalcProgrammer1 » 24 Nov 2009 20:58

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Streaming a webcam with minimal latency

Postby Rémi Denis-Courmont » 25 Nov 2009 18:15

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

norbinus
New Cone
New Cone
Posts: 4
Joined: 11 Mar 2011 18:37

Re: Streaming a webcam with minimal latency

Postby norbinus » 11 Mar 2011 18:56

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Streaming a webcam with minimal latency

Postby Rémi Denis-Courmont » 12 Mar 2011 08:47

http caching is on the receiver. But if you transcode, you're going to have high latency. That's hardly avoidable.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

hussam_2000
Blank Cone
Blank Cone
Posts: 65
Joined: 03 Aug 2010 21:03

Re: Streaming a webcam with minimal latency

Postby hussam_2000 » 19 May 2011 03:37

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.


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 4 guests