Page 1 of 1

Streaming webcam to a webserver

Posted: 13 Jul 2007 00:48
by frederick1978
Dear all,

I have a computer running on Linux Ubuntu with Apache HTTP server and VLC installed.
I would like to stream my webcam on a web page hosted on this computer using VLC.
1. which is the command that I need to send to start the streaming to the apache server?

2. which ports do I need to open on the firewall?

3. Which is the html code to visualize the webcam

for the Windows Media Player plugin the html code is:
<OBJECT id="Player" width="320" height="240" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
<PARAM NAME="URL" VALUE="mms://sourceip:port">
<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
<PARAM NAME="AutoStart" VALUE="True">
<PARAM name="uiMode" value="full">
<PARAM name="PlayCount" value="9999">
<PARAM NAME="stretchtofit" value="true">
</OBJECT>

Thanks a lot for your help

Federico

Re: Streaming webcam to a webserver

Posted: 21 Jul 2007 23:42
by jpzone
Hi Federico,

I dont much about this but can tell you something I did and it worked..

1. which is the command that I need to send to start the streaming to the apache server?

I wrote a script like -

make sure you have a working camera and videox device created and test it by capturing the webcam frames using vlc. now install apache server on ubuntu may be with apt-get.

following script will start the http server. it will start listing for requests for http streaming on your linux machine (IP-192.168.91.77) on 8080 port. It will not stream start sending packets on network until it gets a request from a client. now to test this, open vlc player on any other machine and try carpturing the network stream by typing http://192.168.91.77:8080. you should see webcam frames.

#!/bin/bash
/etc/init.d/httpd restart
vlc -vvv v4l:/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=192.168.91.77:8080}' --ttl 12

you can play here with codecs and other options if you want.

2. which ports do I need to open on the firewall?

not sure about this..

3. Which is the html code to visualize the webcam

here is a webpage I created in /var/www/html/ to embed vlc player in webpage which will capture the same network stream mentioned above. (Ref- vlc documentation)

<html>
<head><title>Webcam Streaming</title></head>
<body>
<h2><font face="Verdana">Webcam Streaming</font></h2>
<embed type="application/x-vlc-plugin"
name="parth"
autoplay="no" loop="yes" width="640" height="480"
target="http://192.168.91.77:8080" />
<br />
<a href="javascript:;" onclick='document.parth.play()'><font size="5"> <b>Play</b></font></a>
<a href="javascript:;" onclick='document.parth.pause()'><font size="5"><b>Pause</b></font></a>
<a href="javascript:;" onclick='document.parth.stop()'><font size="5"><b>Stop</b></font></a>
<a href="javascript:;" onclick='document.parth.fullscreen()'><font size="5"><b>Fullscreen</b></font></a>
</body>
</html>

now restart the http server with above script. on client machine you should have vlc plugin in mozilla firefox webbrowser. type the server IP and u should see the embedded vlc player capturing webcam stream.

this works for me firefox and safari browsers but IE crashes on client side for some reasons.

hope this helps somehow..

Re: Streaming webcam to a webserver

Posted: 22 Jul 2007 01:25
by frederick1978
Thanks a lot for your reply.
It took me a while to understand the logic but at the end I did some improvements. :D
I couldn't have it working before because I was trying to use the public IP and not the local IP of the webserver.
However, I still have some additional concerns that I posted in another post titled "streaming webcams".

Thank you
Federico