stream local webcam to webpage

About encoding, codec settings, muxers and filter usage
Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

stream local webcam to webpage

Postby Jyske Web » 06 Nov 2010 12:03

Hello VLC Experts,

I want to know how to save local and IP webcam stream as file on PC or server. Or better stream local webcam directly to webpage so that
all on the internet can se the webcam.

But how to do that??

I have search and search in the VLC topics and haven't found the answer.

1) On my webform (.aspx) I have a <object> where Id="vlc1" that embed the VLC plugin.
2) On the html boby I call a javascript funtion like this: <body onload="play4();">
3) Here is the java function:
<script type="text/javascript">
function play4() {
var vlc = document.getElementById("vlc1");
var mrl = "http://camcure.myipcamera.com:1024/img/video.asf"; //my IP camera
var options = new Array(":dshow-size=320*240", ":sout=#transcode{vcodec=DIV3,vb=256,scale=1,acodec=asf,ab=32,soverlay}:duplicate{dst=display, dst=std{access=file,mux=ogg,dst=\"c:\\testing.ogg\"}}");

vlc.playlist.playItem(vlc.playlist.add(mrl, null, options));
vlc.playlist.play();
}
</script>

What am I do wrong ?? Please help me experts - thx. a lot!!

Best regards and sorry about my english !
Ole - a developer
from litte Denmark

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 08 Nov 2010 00:13

You might get a better response here for the VLC web plugin.
viewforum.php?f=16

For an alternative approach, try
Basic
http://wiki.videolan.org/Simple_Stream_VLC_to_Website
Better
http://wiki.videolan.org/Stream_VLC_to_ ... _and_Flash

Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

Re: stream local webcam to webpage

Postby Jyske Web » 10 Nov 2010 15:20

Hi Greg,

Thank you so much for you help and reply on my topic above.

I don't have VLC installed on the server where my website is hosted (my website is hosted by a danish aspx hosting company) ...is that a problem ??

I think that I can manage the .asx file and the HREF in the HTML file but where to embed/put
the box 1 + 2 with the "":sout=#transcode......" code ??
Do I have to make some javascript with a function ??
and do you have a example to handle it ??

I hope you will answer me on this ....Please !! c¨,)

Best regards
Ole

Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

Re: stream local webcam to webpage

Postby Jyske Web » 10 Nov 2010 16:50

Hi Greg and other experts :O)

I have an idea and a solution that works local - that means that it is only me who can see the local webcam on the webpage.

Here to go:
1) On the body I embed the VLC plugin like this: <object type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" id="vlc1" height="340px" events="True" >

2) Then I have made a javascript function where I capture the local webcam on my computer and show it in the VLC plugin above with the Id=vlc1....here is the function:
function play() {
var vlc = document.getElementById("vlc1");
vlc.playlist.add("dshow://", "Acer Crystal Eye webcam", null);
vlc.playlist.play();
}

That's works fine !!

But how can I stream the webcam to the hosting company server so that all over the world can see me ??

Please help ! I really hope you can help me...... c¨,)

Best regards
Ole
from Denmark

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 10 Nov 2010 21:51

Do I have to make some javascript with a function ??
No, not for the .asx example in your previous post
I don't have VLC installed on the server where my website is hosted (my website is hosted by a danish aspx hosting company) ...is that a problem ??
Your first problem may be that you remote web host may well not allow streaming from their servers? Most prohibit the practice, because it can use a large amount of bandwidth. You may face problems with excessive bandwidth charges or breach of contract? Do check this out. Do not assume. There are remote web hosts who specialise in streaming.
OR
Serve the stream yourself, from your own webserver, and provide a link from your remotely hosted website.

The two wiki links I referenced cover use of VLC with a local webserver accessable by LAN or WAN. You may be a little confused or be reading too much into what the wikis are describing. They are not suggesting a method for use with a remote web host/server.

However, to try to answer your query - problem. The webserver does not need to have VLC running on it. You will need to point to the source of your stream from VLC in your html, like.... HREF="http://ip:port/path/filename.ext" in the wiki examples I referenced. I suggest you try this out on your LAN first. Then perhaps try it out across the www using a friends pc from a different location. Which ever method of embedding you adopt this principle remains the same. The specific syntax will vary according to the player and method adopted.

Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

Re: stream local webcam to webpage

Postby Jyske Web » 11 Nov 2010 15:48

Hi Greg,

Thanks again for you reply !!

Can HREF="http://ip:port/path/filename.ext" be http://www.MyWebpage/path/filename.ext without port ??

and could you give me a fully sample/tutorial (I'll gladly pay you) ??

Best regards
Ole
from Denmark

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 11 Nov 2010 23:15

and could you give me a fully sample/tutorial (I'll gladly pay you) ??
No, but you contribute here
http://www.videolan.org/contribute.html
Can HREF="http://ip:port/path/filename.ext" be http://www.MyWebpage/path/filename.ext without port ??
No, why would you want to omit the port?

I will try go give you an example explaination similar to the wiki links I posted.
This output from VLC
:sout=#transcode...............,dst=0.0.0.0:8081/stream.flv},dst=display}

The computer that is capturing/transcoding/streaming the above from VLC will have an IP (or name, or fqdn) that identifies it on a network.... Yes?
Re my previous post...
The "player" embedded in html on your webserver (wherever that is) will need to know where the stream is located and what it is called.....Yes?
So the HREF="http://ip:port/path/filename.ext" would define this location and identification....Yes?
For a LAN this would simply be the local IP (or name or fqdn) followed by the port, followed by the path (if any) followed by filename.ext (Eg stream.flv)
Try it out locally on a webserver your LAN first.
To get the stream out on WAN, you will need to use your own external IP, or fdqn (not the IP - fqdn of your remote server) In effect the stream is being relayed, so you need to know where is is comming from before you can send it somewhere else.
This post covered similar issues
viewtopic.php?f=4&t=71514
Search through the forum, there are several posts relating to streaming a webcam locally or globaly

Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

Re: stream local webcam to webpage

Postby Jyske Web » 12 Nov 2010 17:48

Hi Greg,

Thanks a lot again I must say and you are a patient guy :O)

So the only thing I need is a .asx file and the <embed HREF> on the body and that's all...yes ?
You say: "To get the stream out on WAN, you will need to use your own external IP"...that I understand but is the port still 8081 ?

Best regards
Ole
from Denmark

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 12 Nov 2010 18:00

I take it that you have proved this out on your LAN first?

Otherwise, yes in principle, but you will probably encounter some things to overcome on the way???

The port number will remain the the same as the stream source. Don't forget to open that port in firewall and router!

Edit...

Do be aware that your are the source using this technique, therefore it is your upstream bandwidth that the clients will be connecting to and using.

Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

Re: stream local webcam to webpage

Postby Jyske Web » 16 Nov 2010 13:23

Hi Greg

.asx file is that .ashx file in VS2010 ?

/Ole

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 16 Nov 2010 13:54

.asx file is that .ashx file in VS2010 ?
No

Carefully Re read the wiki here in particular.....

"The following method/technique uses a “metafile” or redirector. You might want to check out the terms ”metafile”, “redirector” and “.asx” for further information "

http://wiki.videolan.org/Simple_Stream_ ... The_method

Jyske Web
New Cone
New Cone
Posts: 9
Joined: 26 Aug 2010 12:49

Re: stream local webcam to webpage

Postby Jyske Web » 16 Nov 2010 15:52

Hi Greg,

I would prefer to make a javascript function like this:
var options = ":sout=#transcode{vcodec=WMV2,vb=400,fps=15,width=256,height=192,deinterlace,acodec=wma2,ab=64,channels=2,samplerate=44100}:duplicate{dst=std{access=http,mux=asf,dst=MyHostCompanyIPaddress:21/stream.flv},dst=display}";

vlc.playlist.add("dshow://", "Acer Crystal Eye webcam", options)

where dst=MyHostCompanyIPaddress:21/stream.flv is the destination to send the stream file and Acer Crystal Eye webcam is the name of my local webcam.

Is that possible and how to play the stream file (stream.flv) from the Host Company server on a webpage in a html body ??

Please help :roll:

Best regards
Ole

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 16 Nov 2010 17:18

I would prefer to
If you prefer to do it your own way, then Good Luck...!

Your proposal makes no sense to me and seems to be an unworkable mixture of .asf & .flv
The wiki examples and links provide a proven and workable solutions even for a remote server. If you prefer not to adopt that approach,then I am unable to suggest anything more than I already have

cantest
New Cone
New Cone
Posts: 2
Joined: 16 Dec 2010 15:46

Re: stream local webcam to webpage

Postby cantest » 16 Dec 2010 16:03

I have read and re-read the Simple Stream Tutorial
as well as the more complex H264 example

I am working on an exclusive linux (Ubuntu) environment
desktops are Ubuntu
capture computer is Ubuntu
local web server is Ubuntu
remote web server is Ubuntu

I can stream VLC on the LAN and out to the WAN
I run an IPCOP firewall and port forward to my capture computer
that works fine

What I can not figure out from the tutorials or the forums is how to display a live stream on a web page
I have installed jwplayer, flowplayer and even tried that Theora plugin mozilla-vlc
the mozilla-plugin-vlc does not work even a little bit even when I try it on a windows computer
the jwplayer and flowplayer work fine if I have a mp4 file or wmv file

I have setup two LAN web servers
one is apache2 on Ubuntu
the other is lighttpd on Ubuntu

both with modified mime.types and plugins for FLV / ffmpeg, and MP4 and an ASX mime type

really missing the connection oh how to stream live video using VLC to a web page
using any player or plugin combination

looking for a VLC guru that can point out my mistakes

thank you

Greg
Cone that earned his stripes
Cone that earned his stripes
Posts: 316
Joined: 24 Feb 2009 00:37

Re: stream local webcam to webpage

Postby Greg » 16 Dec 2010 22:57

that can point out my mistakes
You have not given details of what you have tried, so no clue as to what mistakes you may have made.

So to keep it simple to start with, post back details of what you tried in the "Simple stream..." wiki LAN method including.
The sout string you are using
The metafile
The line of html to embed


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 15 guests