movie not smooth (shocking)

Oct 27, 2009 at 2:50 PM
Edited Oct 27, 2009 at 2:57 PM

my movie using media kit is playing but ''shocky'' a bit








<DShow:MediaUriElement Source="{Binding Source={StaticResource cfgMenuMain}, XPath=default/moviesource}" LoadedBehavior="Manual" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Center" PreferedPositionFormat="Frame" VideoRenderer="EnhancedVideoRenderer" Name="myMediaElement" MediaOpened="myMediaElement_MediaOpened" MediaEnded="myMediaElement_MediaEnded" MediaFailed="myMediaElement_MediaFailed"   IsRenderingEnabled="True"/>


myMediaElement.Play() from code is used to let the movie play.


RenderTier = 2

DirectX installed 9.0c (4.09.0000.0904)

EVRPresenter32.dll and EVRPresenter64.dll are in the same folder as the executable.

When I start the thing, I get an exception: TargetInvocationException was unhandled

If I change to VideoRenderer="VideoMixingRenderer9" is works, but the movie is not smooth

The movie is a .vmw which plays correct in WMP (11.0.5721.5145)

MediaElement does show the movie smoother, but it does not want to play the first seconds of the movie


Anything I can do to get the movies to play smooth ? (not shocky or less shocky than now)

Any help greatly appreciated

Oct 28, 2009 at 8:36 AM

It really sounds like a hw performance issue.  MediaElement can give the best performance due to it being closer to the the milcore, but if it's having perf issues, I don't think MediaKit will be of much help.

WMP can achieve better performance because it is not subjected to any extra hit by the WPF composition engine.  Also WMP can render using old DirectDraw technology that is well suited for older/underpowered GPUs.  In my tests MediaElement gets very similar performance of WMP given the right setup....otherwise you see what you are seeing.


Oct 28, 2009 at 9:34 AM

its running on a dual core cpu @2Ghz with 2GB RAM.... should not be an issure I think, although the virsuscanner might be a problem. I cannot disable it as its a corporate scanner and not have priviliges to do so. Will do some bare tests with the same movie and a media element in a minimal wpf application to see if its indeed performance.

Oct 28, 2009 at 9:40 AM
What about GPU?  That's even more important than the CPU.
Oct 28, 2009 at 11:04 AM

GPU is NVidia with full HW acceleration... but I think I found something....

I have a 2nd display at the left side of my normal one. To test the application there I have the Left property from the mainwindow set to "-1440". With this setting MediaElement skips the first seconds of movie. When I setup windows that my second display is on the right side of my normal one, and set the left property to "1680" there is no issue.

Seems that MediaElement has problems with negative window positions.

As my application is very urgent for release (its for an exhibition) I will not have time for further invesigations. But as far as I am concerned, the problem is solved with MediaElement (not MediaKit)


Oct 30, 2009 at 11:38 PM

I'm glad you got the problem fixed!  I didn't know you are using multiple monitors.  MediaElement has known issues (as you've noticed) and memory leaks associated to multimonitors.  MediaKit has a known issue with performance issue as the it's hardcoded for the first device.   I've noticed this to mostly be an issue with multiple video cards but has no issues on my tested configurations with monitors with multiple displays.  This can be a new bug to investigate.

It sounds like you have a very urgent project, but I am also very busy.  This is only my hobby, but I realize people have projects in which they use this library and they find issues.  I try to be diligent about that and fix what I can with the time I have for something I ultimatly get nothing back in return but maybe the joy in having a limited amount of success.  All I'm a "Thanks for trying.  We're both busy. The least I could do was answer a few questions on system config so you can better your code" goes a long way.


Oct 30, 2009 at 11:50 PM

I am glad to, and my colleague who's in charge of the exhibition stand is even more happy than me ;o)

due to issues with MediaElement, I tried MediaKit because I had seen the website here before but not had the need to try it. I really appreciate the work done in media kit, although I miss a little documentation that would give a quick start guide (another post from me asking for that, but I am smart enough to find out myself). If I got the time at my desk to do some more tests I will let you know.

Indeed the project is urgent. The application is used in an exhibition next week. This week thursday we went to the builder and found that the screens are in portrait mode instead of the expected landscape. I had to adapt the entire layout. Today (friday) we had to replace 2 screens because of resolution problems. 3pm shipment. I am glad I found this thing with the dual screen, as I had not seen it in internet yet.

Thanks for the replies here, highly appreciated, and keep up the good work....

Oct 31, 2009 at 12:10 AM

Thanks barts!  I hope I didn't sound to brash, but it's hard finding the strength sometimes to keep anything up!  I even have had people beat me up over email on some issues, in which my only reply is to offer their money back ;).

Anyways, one of these days I'm going to fix that hardcoded device I have in there.  It's a bit of code to detect and reinitialize the D3D device when it changes monitors.  Haha..."one of these days"!


Oct 31, 2009 at 12:17 AM

jer... I am not just a graphical designer, nor an artist... I am a software egnineer who came from semiconductor business... now I am somehow in the wrong job ... but its the job I got affected with this media element etc.... gosh how much I wish I still had my old job (our office was closed 2 years ago).... well if that happens... I will refund you 'my 2 cents' probably on that one day you mentioned in your last reply ... ha ha