c# webcam controls? - c#

I am looking to put a camera on top of a my lab in the process of being built and stream it to a website.
How can I be doing this with only c# ? How to get stream of video & send it live on server PC from there he can take instant photos?

Modern web cameras would supports WIA and DirectShow. WIA has a scripting interface which is more friendly to C#, however it is designed for cameras and scanners and is not that fast for streaming. But if you just need to push the image to a server, you don't need to write code, kist use Windows Media Encoder to push to a Windows Media Server's publishing point. You can then get image from the server's publishing point using DirectShow or Windows Media Format SDK. None of these are easy in C# though, you are better off using COM class libraries like ATL for extensive COM programming like this.

If you really want to write this in C#, I've had a lot of success with Egmu.
Capturing images is very straightforward - see this question. After that, it'd be FTP to the server as usual.
I'm curious about Sheng Jiang's Media Encoder solution though. Let me know how you get on.

Related

Create a livestream by XSplit Encoder (RTMP Server)

I'm making a program for do a livestream of the XSplit Encoder (RTMP Server). I need to have a site to watch that stream, and this program, the player need to have a button to the spectator can choose your video quality, and the stream have to be fluid and have a good quality. Can someone explain this or send me a link to do that? Please
(C#)
This is a VERY large undertaking. And an impossible question to answer unless you narrow the scope. You need a ingest server that takes in RTMP, You need a machine with enough CPU power to do all the transcodes. You need site to playback on. You also need enough bandwidth (CDN) for all your viewers. How many viewers do you need to support? What platforms do you want to play back on? iOS? then you need HLS. Web? then you need RTMP. Or you can use DASH if your ok with limiting it to modern browsers. Do you want it to play in firefox? Then it MUST be flash, because firefox does not have native support for the h.264 codec. But flash wont play in iOS. You can use JWPlaver premium, that will play HLS in flash. Actually is h.264 the codec you intend to use? Have you looked into services such as Zencoder live transcoding? Or Wowza with the transcoding module? Amazon offers preconfigured wowza instances. What is your budget for this project? Why not just use twitch?
Edit: You can probably string something together using ffmpeg:
https://trac.ffmpeg.org/wiki/StreamingGuide

Get image from webcam

I'm trying to find the way for getting image (only image, not video stream) from webcam in managed C#.
Usually people suggesting libraries, but they are old or commercial or under gpl.
How get image from webcam without third-party libraries?
upd.: thanks for Media Foundation, I shall use that.
Web cameras are supposed to deliver video feeds, not stills. So the native API you might be interested in is the one for video capture, which are DirectShow and Media Foundation.
The one you would most likely want is DirectShow, but it is not well suited to be interfaced from managed code, so you will need a DirectShow.NET which is open source wrapper. You typically start video streaming there and once you have a good image you stop the activity.
Or instead you might keep looking for a ready to use library which does the mentioned above for you.
One of DirectShow.NET samples does what you look for.
DxSnap – Use DirectShow to take snapshots from the Still pin of a
capture device. Note the MS encourages you to use WIA for this, but if
you want to do in with DirectShow and C#, here's how.
It mentions WIA, however WIA API is not available for all (or any in recent OSes?) web cameras, WIA more targets device like scanners.
Other APIs are perhaps less suitable.
VFW ("avicap32.dll") limits you to a subset of devices, is simple yet not well interfaced into managed code
Media Foundation is not well available in earlier OS versions
I wrote this many years ago
http://www.vbforums.com/showthread.php?344471-Vb.Net-WebCam-Class-(ICam)) in VB.net
You could easily port it to c#?
Is avicap32.dll out of the question?
Otherwise I think this is a simple and straightforward way:
http://www.creativecodedesign.com/node/66
http://www.c-sharpcorner.com/uploadfile/yougerthen/integrate-the-web-webcam-functionality-using-C-Sharp-net-and-com-part-viii/

stream webcam via webpage asp.net

H,
How do I stream my webcam through a webpage in c# using asp.net
Thanks
Sp
Depends what you want: streaming (more delay but better quality) or live view (like MSN, Skype Video, etc - less delay but lower quality).
For the first one, you need an encoder API as well as some media server to distribute the video for you. For the latter, you need Flash, Skype API, or similar API and users need direct access to (a port) on your PC.
Tell us a bit more about what you're trying to achieve. Since I've been in this business for years, I might be able to help you out if I get to understand what you want.
If this sponsored event happens only once, you can get a 2-week free trial from StreamZilla (http://www.streamzilla.eu/online-store/online-cdn-store) and use Flash Media Live Encoder (http://www.adobe.com/products/flashmediaserver/flashmediaencoder/) to stream via their network. This will make it 100% free (assuming that you provide the webcam and a powerful PC yourself).
Other providers (eg. UStream) might have trial periods as well, or you might even get it for free if you explain them about the charity part. I've got good experiences with StreamZilla and UStream's Watershed.
Contact me if you need more help.
If you are asp.net then silverlight 4.0 is way to do this. Silverlight is application framework to develop rich internet application and this now supports all webcam api also.
Here is the link to display how you can do this.
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/11/18/silverlight-4-rough-notes-camera-and-microphone-support.aspx

Simulating Screen capturing as a webcam?

Do we have a way to simulate a webcam driver, that will provide realtime captured screen (30 frames per sec) as it's output?
This is one of several features of ManyCam (free). It is a virtual webcam driver through which you can stream your real webcam video (with optional real-time video effects), video or image files, or your full/partial desktop.
Yes, just google video2webcam. It works quite well and will loop a video or picture as output.
The driver's job is to provide a level of abstraction between the software and hardware. The driver is supposed to issue commands to the hardware. It's not responsible for taking pictures and turning it into an animated GIF for instance. It's going to do low level stuff like, turn the device on and off, send raw data to a socket.
That being said, if you need to create a virtual device driver. Here's an overview of VDD's. Windows Programming/Device Driver Introduction
Generally these are not written in higher-level languages such as C#. Rather, they are written in languages such as C/C++. You will need the KMDF, or Kernel-Mode Driver Framework.
If you just need to access a webcam from a .NET application on a system with a webcam, you just need an API.
Open your browser.. go to google.com and type ".NET webcam API"
You will see something like this:
Webcam in your own application
It appears that this is a wrapper for the DirectShow class.

How to implement live video broadcasting in C#?

I want to plug a live video broadcasting facility to a website. I'm planning to use silverlight and C# but I'm very newbie in this topic.
What is the best way to do this?
Thanks in advance.
Update:
I have a camera. I want it to capture it and show on my website. Live. But I have no idea about what I must do inside. Tell me everything about the capturing, streams, api's, dll's, whatever else I need to know. Thanks.
If you're on Windows, you may want to consider the free Windows Media Encoder 9 SDK (http://www.microsoft.com/windows/windowsmedia/forpros/encoder/features.aspx). The idea is that Windows Media Encoder allows you to use any device as a media source (say, a video capture card or a streaming-enabled camcorder) and to push it out as an ASF stream, or even to multicast/broadcast it via Windows Media Services.
The WME SDK is simply a programmatic (COM) interface to WME. In principle you can automate the encoder and instruct it to use your camera as a source, and push it out to a specified UDP port or publishing point (for the latter you'll need Windows Server 2003/2008 with Windows Media Services installed).
A newer alternative is Microsoft Expression Encoder SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=9A077A3D-58CE-454C-B486-153F0578BE4A&displaylang=en), which "talks" to Expression Encoder and allows you to stream out to Silverlight clients (among others), but the caveat here is that EE is not free (WME is).
do you have a live stream? Or is that the part you need? If you already have a live stream with a URI, then you could use Silverlight to display it as all you need is a player and a URI (you can get a player anywhere, here's one http://sl2videoplayer.codeplex.com).
If you don't have the stream, then what you will need is some mechanism to capture video and stream it. You can use Windows Media Server to do the streaming.
Can you clarify what pieces you have and what you need?

Categories