Why isn't WPF's MediaElement showing my DivX Video? - wpf

I have some simple WPF with a MediaElement which is, generally, working.
I have some simple AVIs and WMVs which are working.
I have a DivX AVI that works fine in Media Player but doesn't render at all in the WPF MediaElement control. It plays the audio fine, but graphically has zero size and doesn't render any video!
I have tried using the WPF Media Kit at wpfmediakit.codeplex.com and manage to extract an error from that: Could not render any streams from the source Uri.
The RenderCapability.Tier reports 0x00020000 (Tier 2) - the graphics card should be capable!

Are you on an x64 operating system? If so compile your application as x86 instead of any CPU. This will ensure your application will be able to load what are most likely 32bit DirectShow filters.

You need to use a codec that is supported under WPF. DivX isn't.

Related

WPF-DirectX Interop Problem (D3DImage)

I'm writing a Video application utilizing D3DImage. Frames are from memory and rendered as textures in native code with DirectX9, finally exposed by D3DImage to the WPF GUI. I have some Overlays on top, created with WPF's painting framework (Text, shapes etc.). Up to this point, it works like a charm.
Now, I would like encode the composited image from my underlying native C++ code. Video is 640x480 BGR, 25 FPS and has to be rendered and encoded in parallel, also on older Hardware with Windows versions down to XP/SP3.
Problem is, I cannot find any documentation describing the composition process between WPF and D3DImage. They 'blend' in some sense, but what is the meaning of this? And is it possible to get a handle to the WPF's part of the drawing or even the composited image in my native C++ code?
p.s: I'm also open to managed solutions, but didn't found much performant up to now.
There is global static method called "CompositionTarget.Rendering". Add an event to that and every time WPF renders that method will be called before WPF presents(the FPS can vary though). So just updated your renderTarget accordingly.
There might be a better way, but i'm not aware of it.
NOTE:: Also for D3DImage on WindowsXP you use a D3D9 device with a lockable renderTarget while on Vista/7 you use a D3D9Ex device with a non-lockable renderTarget. Just a note.

How to use a windows forms embedded resource as the Source for a WPF mediaelement?

I am hosting a MediaElement in a WinForms application, which I would like to play both images and video through. My images and video are set as embedded resources to the application.
The MediaElement.Source property only accepts a URI.
Any ideas on how to get the MediaElement to play the embedded resourece files without writing them to disk?
Thanks.
MediaElement cannot play from embedded resources files. It would be possible by writing your own DirectShow source filter, but that might be a lot of work for little benefit.

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.

Issue using WPF MediaElement with HD (H.264, 720P) Video

I am using media element to render video in WPF. All videos are working fine except H.264 videos. They have some stuttering problem while they are rendered on screen. My machine configuration is much more than the recommended requirement to play for this video. Another surprising fact is that the video renders perfectly fine when I play this in Window Media Player or any other player.
Any solution or any alternative to MediaElement?
You can try my MediaUriElement from my open source project here: http://wpfmediakit.codeplex.com
It has better media compatibility than MediaElement, but if it's a decoder filter problem or a performance problem, my project won't be able to help. What h264 codec are you using. You may want to try out ffdshow from http://ffdshow-tryout.sourceforge.net/.
-Jer
WPF does not support H.264 videos

Resources