How to display videos in WPF Application - c#

Hello I am writing a WPF application which should plays a set of videos which should played fullscreen.
i tried to work with some VLC lib's but they did not worked for me.
then i moved to mediaelement - when i start playing a video i always get a black flicker
loading multiple videos was a huge performance loss - videos stuttered...
any recommendations how to resolve this issue ?
i plan do the following programm:
the kinect detects people which move along --> the programm plays a video
if people stop and watch the screen --> the programm plays a extended version
UPDATE: checked vlc.net and it will also have a BLACK frame at the beginnign -- ARGH !
UPDATE: seems like the first frame is always black!? hmmm (added timer and started the video 1 second after it was loaded - still have the black frame ...)

Solution for my application : i use vvvv.org and send my data trough a UDP connection - i handle the video stuff in this VVVV application - works great ... i am very disapointed by microsofts video support ... i hope this will get better in the future thx anyways :)

Related

Playing videos without lag or black screen in C# winforms

I m working on this project, the client gave me the task to design the UI and embed videos. The backend code of that application is complete according to the client and the backend code is really poorly written with zero optimization.
The application is working perfectly, the application starts the main form loads axWindowsMediaPlayer form with it self and axWindowsMediaPlayer loads videos through resources. The issue is that in the beginning of each video the media player blinks, like if the playlist have 3 videos it'll blink 3 times and if I run the axWindowsMediaPlayer form separately it doesn't blink at all.
I've no idea what to do here.
Standart windows media player control is way too dated. It's basically good for nothing at this point. I'd just open nuget package list and look for any video player control. In case there is none, you can always just add a chromium-based webview element and play your video in there.

What causes Bad Audio Performance during Video Playback using a WPF MediaElement?

I've searched high and low for a steer on this issue.
When I setup a C# WPF MediaElement to play a MP4/WMV video in test project, the video plays and the audio sounds fine.
When i try the same in my actual project, the video jumps and the audio pops and clicks (not in unison).
Can anyone offer a solution for this issue, or at best a debugging strategy?
Thanks

How to make MediaElement work as good as AxWindowsMediaPlayer?

I need a very simple video player in my C# app. It only has to loop a video from file and nothing more. Since I'm developing a WPF application, I've tried to use System.Windows.Controls.MediaElement. It has all the functions I need, but works quite poor: I've played some full HD videos on it, and it's always lagging and spiking.
To make sure, it's not my app problem, I've created 2 test applications. The first in a WinForms borderless 1920x1080 window with only AxWMPLib.AxWindowsMediaPlayer control. And the second in a borderless WPF window of the same size with System.Windows.Controls.MediaElement.
Then I run 2 videos on both of players. Here are their specs:
1: 1920x1080, 12000kb/s, 25 FPS, wmv
2: 1920x1080, 5730kb/s, 25 FPS, mp4
On AxWindowsMediaPlayer everything looks fine. But MediaElement seems to drop some frames and ignore vertical sync (it's possible to see parts of one frame on another during fast scene changes). So, it's completely unsuitable and shouldn't be like that, but I've found nothing about the problem in Microsoft official docs (they only suggest to use MediaElement instead of AxWindowsMediaPlayer in WPF apps). Is it possible to make it work more smoothly or using an additional WinForms Form with AxWindowsMediaPlayer is the only solution?
It was written over five years ago (look up James Dailey messages in the thread), there were possibly some improvements but overall I suppose the statements are still in good standing. I will pick up some relevant quotes:
As you know the WPF environment is constructed from the ground up to offer developers a very rich “graphics first” environment. The MediaElement in particular was designed to allow you to mix video with various other UI components seamlessly. This solution will give you the flicker free, “draw over video” solution that you are looking for. The best part is you can do all of this in C#. The bad part of this solution is that the MediaElement is not designed for displaying time sensitive media content. In other words, the MediaElement is notorious for dropping and delaying the display of video frames. There are ways to minimize this such as using SD rather than HD content, use a video accelerated codec, etc.
also:
Unfortunately you can’t really tell the WPF MediaElement to never drop frames. The term we use for this class of issues is “disparate clocks”. In this case WPF is updating the screen at a certain rate (clock 1). The MediaElement (based on WMP) is cranking out video frames at a slightly different rate (clock 2). Given the underlying technologies there is currently no way to synchronize the two clocks and force them to “tick” at the same rate. Since the display will only be updated according to the WPF clock, multiple frames of video may be sent from the MediaElement to WPF between clock ticks. Because of this the MediaElement may appear to drop frames. This is a very common problem in multimedia development and there is no simple solution.
Windows Media Player uses Media Foundation and DirectShow APIs which power media playback with high quality video experience.

MediaElement - Video Gets out of Sync with Audio - WP7

I am using MediaElement in my wp7 project which plays the video from online stream (mp4 format)
Things seems working but sometimes I noticed that Video gets a bit quick like playing in fast mode for a while and that makes video a bit ahead of Audio.
So whats the reason, Should I use MediaStreamSource or should I use SmoothMediaElement?
I thought it might be due to there are some threads which are updating UI using "Dispatcher.BeginInvoke" so I tried stopping all of them but problem remains there so it can be due to slow network or something but it shouldn't be doing like this. :(
Please help.

Loading many videos in WPF (.NET 4)

I am developing a WPF application (in .NET 4) which
contains a lot of videos (40 videos, each video > 1 G) using the WPF
media element. Unfortunately, I cannot load more than 10 videos at a
time. When I try to display more videos, a black screen appears
where normally the video should be played.
Has anyone ever experienced such a problem and found a solution? It would help me a lot.
In the mean time, I found the solution: calling 'close' on a mediaelement frees the memory... .

Categories

Resources