Streaming webcam to a webserver

*nix specific usage questions
frederick1978
New Cone
New Cone
Posts: 5
Joined: 13 Jul 2007 00:31

Streaming webcam to a webserver

Postby frederick1978 » 13 Jul 2007 00:48

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

jpzone
New Cone
New Cone
Posts: 8
Joined: 21 Jul 2007 22:34

Re: Streaming webcam to a webserver

Postby jpzone » 21 Jul 2007 23:42

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..

frederick1978
New Cone
New Cone
Posts: 5
Joined: 13 Jul 2007 00:31

Re: Streaming webcam to a webserver

Postby frederick1978 » 22 Jul 2007 01:25

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


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 4 guests