Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce the delay - VLC Streaming from a web cam

I am streaming video and audio from my web cam/microphone over UDP. When I view the stream (even on the same machine) there is a delay of about 4 seconds. I have tried setting the UDP Cache setting to 0, or 1 but it doesn't seem to help. I have tried reducing the video and audio bit-rates, using mono sound and reducing the sample-rate all to no avail.

Does anyone have any ideas how I could reduce the delay, to something better suited to for a video conference, i.e < 1 second?

Is there a setting I can apply to the viewer/streamer that can help?

Thanks,

Marc

like image 349
Marc Avatar asked Feb 02 '12 20:02

Marc


2 Answers

Try this.

#!/bin/sh
ETH=eth0

cvlc --miface=$ETH v4l2:///dev/video0 :input-slave=alsa://hw:0,0 :sout=#transcode{vcodec=h264,venc=x264{preset=ultrafast,tune=zerolatency,intra-refresh,lookahead=10,keyint=15},scale=auto,acodec=mpga,ab=128}:rtp{dst=224.10.0.1,port=5004,mux=ts} :sout-keep >/dev/null 2>/dev/null &
vlc1=$!
vlc  --miface=$ETH rtp://224.10.0.1 >/dev/null 2>/dev/null &
vlc2=$!
wait $vlc2
kill -9 $vlc1

I've 2 seconds delay with 720p webcam, it produce about 2.5Mbit/s trafic and load for one core ~30%.

like image 28
kovserg Avatar answered Sep 29 '22 07:09

kovserg


If you are using rtsp protocol to stream to video/audio, you can adjust the delay at

tools->preferences->all->input/codecs->demuxers->RTP/RTSP->caching value

tools->preferences->all->input/codecs->demuxers->RTP->RTP de-jitter buffer length

like image 56
ciphor Avatar answered Sep 29 '22 08:09

ciphor