vlc to stream webcam with no delay

4

I'm trying to get VLC to show my webcam in realtime:

vlc -I dummy v4l2:///dev/video0

does the trick for the most part, except there's almost a second delay between an action (say, me turning my head) and seeing it in the video window. Is there any way to reduce the lag, or other software I can use (Gentoo Linux)?

Mala

Posted 2010-06-19T22:48:14.170

Reputation: 5 998

Answers

2

That's more than likely just a limitation of the webcam. Like early cellphone cameras (newer ones probably have less of a problem), webcams typically have lower frame rates and have, both, slower light sensors and also take longer to process the captured video frames. This causes there to be a delay between real-time and the displayed video. Having a USB connection between the camera and the PC also adds to the delay.

What you could try doing (besides upgrading to a better webcam) is to improve the lighting conditions. Digital cameras tend to take longer to capture a image in low light conditions because it takes longer to capture the necessary amount of light to produce a decent image (sorta like slowing down the shutter speed in an analog camera). Using a FireWire camera could also speed things up slightly.

Lèse majesté

Posted 2010-06-19T22:48:14.170

Reputation: 3 129

Honestly, there really isn't much that can be done about this... the webcam likely is the culprit. – Nathan Osman – 2010-06-20T05:17:50.297

2

Bizarrely I am trying to solve this same problem and I have found a little success. I am using an HP HD 3110. They have them at best buy for about 20 bucks. Anyway I tried using it with VLC and third party software and I had a lag of about 300ms and for what I am doing that is almost unacceptable.

Brightness helped and setting the exposure to be fixed really low appeared to help, but it may simply raise the frame rate which is not necessarily the same as reducing the latency. Ultimately the best performance came from using the software that came with the webcam.

The latency is in the 100ms or lower ballpark which is below what humans typically detect without effort. I have no good explanation for this. Its possible that VLC and the other software I used buffered the images a little much or the software that came with the device may be accessing hidden options for the webcam.

The main issue is your system, but for all I know you may be able to get it to work. Secondly the software that comes with a camera will not make it easy to incorporate into other programs potentially.

Someone

Posted 2010-06-19T22:48:14.170

Reputation: 21

1

Most cameras have some parameters, to adjust brightness level, etc.

You should turn off auto brightness, and maybe lower the brightness level. You will get darker image in low light conditions, but hopefully with reduced lag.

Cammer

Posted 2010-06-19T22:48:14.170

Reputation: 11

0

In the event this question is still relevant to someone, there is a setting visible when All is enabled under settings - see /Stream output/Sout stream/Display for Delay (ms). This value is 100 (ms) by default, and should be considered, as well as buffer values, when rebroadcasting/streaming/transcoding video.

I believe this Display value would apply, if you are just looking at displaying the video, and not streaming it.

user3.1415927

Posted 2010-06-19T22:48:14.170

Reputation: 296