How to stream Webcam in WPF? - wpf

Can I stream a live video in WPF application from my web cam? If yes, then How?

You will have to use DirectX Capture or something (is not in WPF right know, so use DirectX API's directly).
Look at: WPF Media Kit. It can grab the Vista Windows desktop manager DirectX Direct3D shared Surface, and use it as a visual brush in WPF. He does some nice things with it. Look at his blog where he explains it.
I hope this helps you on your way...
UPDATE 2009-11-06:
The VideoRenderElement Codeplex project has an example on how to stream webcam content.
This project looks like it would fit your requirment perfectly.
UPDATE 2013-02-18:
Alternatively one can use the Expression Encoder SDK. For an example you can look at the WPF-Webcam-Control article on CodeProject

Related

How to use the WinRT SwapChainPanel control in a WPF window?

I added references to WinRT dlls to a WPF project and I want to use SwapChainPanel inside of a WPF window.
Is it really possible? For now I cant get it work.
The NuGet package description for Microsoft.Toolkit.Wpf.UI.Controls mentions a SwapChainPanel but I have not found any samples using this control in WPF.
SwapChainPanel : Provides a hosting surface, where Microsoft DirectX swap chains provide content that can be rendered into a XAML UI. A SwapChainPanel element is a key component for an app that renders Microsoft DirectX graphics and then presents those visuals within a XAML page.
It's not currently officially supported - might require some private APIs in Windows, though since Stardock could implement its ModernMix - there might be some way to get it working. The thing is though - you don't have to do that. You can render content with DirectX to a WPF window in other ways. I haven't done that and it might be quite a bit of work to do, but so is anything in DirectX. You can look into DirectComposition or D3DImage class. Perhaps the article on using Direct2D with WPF can be a good sample solution.
You dont have to, as says Filip Skakun, but you can ! Just give a try to SlimDX or SharpDX. They're DirectX's implementations in C#.

Play RTSP/MMS/Http live video feeds in WPF

I'd like to pull a live video feed into WPF but the MediaElement doesn't appear to support these protocols. An example video stream is here (BP oil leak live feed):
http://mfile.akamai.com/97892/live/reflector:45683.asx?bkup=45684
Are there any solutions for playing live streaming formats in WPF?
I had hopes for using the VideoLan DotNet component but it appears to be incompatible with the latest VLC releases:
http://vlcdotnet.codeplex.com/
If you're talking an IP Camera, point the WPF Chrome browser to it:
http://chriscavanagh.wordpress.com/2009/08/27/wpf-3d-chromium-browser/
(you'll need to license the Awesomium wrapper if it's a commercial app).
If it's just webcam stuff, use the WPF MediaKit:
http://wpfmediakit.codeplex.com/
I've run both in Windows 7.
Looks like this isn't currently possible in Windows 7:
Link

MediaElement Support in WPF

I am evaluating WPF and Silverlight for a Project. I find WPF to be most suited for our purpose since we require performance, graphics support, Office compatibility and the ability to support ActiveX controls. It is also a Desktop application. However there is one area where i find Silverlight to be superior - Media support. I would like to have the WPF mediaelement control to support MPEG4 (H.264) codec.
Can anyone please suggest if this is feasible somehow and if support for the same is in the roadmap of WPF?
The WPF MediaElement uses DirectShow under the convers (well it uses WMP, but WMP uses DShow), so as long as you have an h264 codec installed (Windows 7 comes with them), your MediaElement should be able to play h264 video.
The WPF MediaElement requires the Windows Media Player 10 or above (this can be some deployment problem, so please read the Redistributing Windows Media Player Software) and uses DirectShow filter (codecs) installed on the user's computer. A general rule is if you can play your file in WMP you can play it in MediaElement.
For Silverlight you can found here the Supported Media Formats, Protocols, and Log Fields.
I have some experience with WPF media element but it has some performance hit. so if u have to show image and video you can use D3DImage of WPF in SP1 of .NET 3.5 that is new control of WPF for DirectX interaction and it has better performance over media element. more on D3DImage

Video and Audio Editing components

I need to write a video and audio capability in a WPF application. It need to do video and voice capture with basic editing etc.
Does anyone know of any components that could get me going.
Directshow will be required for audio/video capture from a DV camera unless you are running Windows 7. Then you can use Media Foundation. In both cases, you will need .NET interface libraries, which are already completed (Directshow here and Media Foundation here). I'm not sure if the Media Foundation interface library has support for the new capture functionality though.
I would check out the SpeechRecognizer class, which is new in .NET 3.0. In fact the entire System.Speech namespace is a good starting place for voice capture.
As for video, MediaElement is a full-blown FrameworkElement designed to play audio and video, which can be embedded into your WPF applications.

Need example of Flex or silverlight application that enables interactive drawing on a video

I am trying to evaluate which technology is best for my needs.
I need to display a video I get from some remote device, and let a user
interactively draw on it lines, polygons etc.
I searched and couldn't find any existing applications with this ability
(all the flash applications only displayed video).
Could anyone point me to such an application?
I haven't seen a specific app that allows you to do that, but I can tell you it would be fairly trivial to build it in Flex. You would simply create a transparent Sprite over the video clip, then use the Drawing API bound to various mouse events to do your drawing.
The final image can be saved by using BitmapData.draw() over the container that holds both the video and the canvas, and you can pass a bytearray encoded as PNG or JPG to a server-side script to save it.
I can't speak to Silverlight as I've never used it - but a Flex dev could build a basic sample of this for you in Flex in about 20 mins just as a proof of concept.
Where does your expertise lie?
Silverlight you could knock up a proof of concept rather easily and as Myk points out you could do the same in Flex. So your best bet is really whichever technology your current expertise lies in.
In Silverlight you could use a InkPresenter control above a MediaElement control in about 2 minutes up and running with a video file.
I think the hard part is finding a way to display realtime video from your specific device.
Silverlight supports streaming video so having that device talk with Windows Media Server or Silverlight Streaming sounds like the best bet.
Julie Lerman wrote an Silverlight app that you can draw on Images:
http://thedatafarm.com/blog/tablet/drawing-in-silverlight-article-in-msdn-magazine/
the article was presented at a magazine:
http://msdn.microsoft.com/en-us/magazine/cc721604.aspx
Hopes this helps.

Resources