I'm working with a simple mediaplayer based on this msdn example where the user can control volume, playback speed (SpeedRatio) and seek (Position) using 3 sliders.
Everything works correctly when I play .mp3 files, but as soon as I play an .m4a file the song playback speed, controlled by the MediaElement.SpeedRatio, is ignored. Volume and seek still works and the audio is working.
Questions:
Are there any logical explanations for this?
Any known solutions/workarounds to this problem? The speedratio is essential in my application.
Thanks,
Avada
check this out:
MediaElement Speedratio not linear
Related
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.
I have been searching all over for a way to display the audio intensity of an mp4 file. I have found many guides on how to do it with wav files and even audio being actively recorded, but I can't find anything about mp4s.
I have a C# windows form that plays a video and allows you to caption it. What I am trying to do next is add a visual representation of the audio intensity so the user can see where the next chunk of speech is. To play the video I am using Windows Media Player
You can refer to this other stackoverflow question:
Howplay mp4 songs using NAudio
Instead of playing the file you can show the current level with some widget. Just pay attention to the fact that you should probably display the level in dB:
dB = 20 * log10(amplitude/maxAmplitude)
While beginnning audio playback, I need the ability to set the position in the audio file from where to begin the playback.
Please guide me with the API's to be used for this functionality.
Until now I have been using SoundEffectInstance for audio playback, but I do not see an option to set the audio playback position in that.
There are many different ways to play audio, see Media for Windows Phone. Without knowing which one you're using, it's a bit difficult to answer the question.
The MediaElement class has a settable property for Position that could serve your purpose.
I need to be able to play a "ding" sound in Windows 8 (a kind of beep that fades out gently), similar to what is seen here: http://tonematrix.audiotool.com/
Is it possible to somehow play this given a frequency? Or can I download sound files for this anywhere?
I noticed how the SoundPlayer no longer works, so the old code I used in my desktop program won't work anymore.
If you have a sound file of it, such as an mp3 or wav, use the MediaElement control. There are a few ways of doing this. For example, set the Source property to a URL (Uri class) or call SetSource() then the Play method.
Windows 8 does not include an easy way to generate a tone or pitch (assuming you mean metro/Windows Store apps). If you can generate the bytes needed to play the sound, place them in a buffer, create an IRandomAccessStream for it then pass it to SetSource. You can emulate the fade out by setting the Volume with a Timer.
It would be nice if there was a "fade out" audio effect that could be used with SetAudioEffect but Microsoft does not provide any audio effects at this time.
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 :)