unosquare / ffmediaelement

FFME: The Advanced WPF MediaElement (based on FFmpeg)
https://unosquare.github.io/ffmediaelement/
Other
1.17k stars 240 forks source link

Big problem when playing 2K and 4K videos #508

Closed phamvv closed 4 years ago

phamvv commented 4 years ago

Hi brother! I added the function to adjust the pitch independently of the speed and everything works great, but the problem is when I run and play 2K and 4K video. The picture and sound are broken. and CPU performance is too high while not using GPU performance. I tried removing the audio and video synchronization. The problem is improved, but the image runs faster or slower than the audio plays.

Do you have any ideas to help me improve it? If I perform the synchronization before the play, then player will only run correctly for the first period of about 20 seconds. Then it keeps running wrong. I hope to receive your comments so I can resolve the problem. Thank you so much!

mariodivece commented 4 years ago

Sadly, this is due to the fact that the raw output of ffmpeg has to be done in RAM. I have tried multiple experiments rendering to a hardware DX surface and passing that to the hwnd of the WPF window. Unfortunately this breaks transparency, layout, and creates other problems. It doesn't look like the WPF API will be updated to be able to pass DX shared surfaces directly to its own render loop. On the other hand, WinRT does have what seems to be needed in these cases: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.swapchainpanel?view=winrt-19041

FFME is for WPF and WinForms -- it's not designed for WinRT.

OneB1t commented 2 years ago

Hello Mario Is there some backup of these experiments with DX surface? i would drop transparency and other things if it will make useable.

Thanks