Apr 152011
I was experimenting with cheap webcam, vlc on my windows xp workstation. Playing directly using vlc, performance was adequate. but when it came accross network/WAN, delay started increasing between 4-5 seconds(video/audio). i suspect, transcoding are behind these streaming lag. i don’t know what is the best tuning. but here’s the final setting.
start /high vlc.exe --logo-file avatar.png dshow:// :dshow-vdev="VideoCAM Eye" :dshow-adev="SigmaTel Audio" :dshow-caching="0" :sout=#transcode{vcodec=h264{keyint=15,vbv-maxrate=160,vbv-bufsize=160},acodec=mp3,deinterlace,samplerate=44100,sfilter=logo}:std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:8088/stream.flv,sdp=sap://,name="Webcam 3G"} --ttl 12
At the gateway side, i’m using iptables to port forwarding/dnat connection from WEBSERVER to my workstation.
iptables -t nat -I PREROUTING 1 -p tcp -m tcp -s WEBSERVER-NETWORK-IP/24 -d GATEWAY-IP/32 --dport 8088 -j DNAT --to-destination LAN-IP:8088
At the webserver, i’m using nginx as proxy.
server {
....
....
location = /stream/stream.flv {
valid_referers blocked example.com www.example.com;
if ($invalid_referer) {
return 444;
}
proxy_pass http://GATEWAY-IP:8088/stream.flv;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
....
....
}
Using wordpress and vipers-video-quicktags plugin, we can post webcam live streaming directly to our blogs.
[ flv]http://www.example.com/stream/stream.flv[ /flv]http://www.kutukupret.com/stream/stream.flv
