Sascha-L / WPF-MediaKit

Microsoft Public License
367 stars 117 forks source link

Video is rotated when playing #75

Closed wj985712588 closed 6 years ago

wj985712588 commented 6 years ago

the direction of some video file is not correctly, who can tell me how to correct it ? thanks

xmedeko commented 6 years ago

What to you mean direction? How is behaviour in other players - e.g. MPC-HC? Also, read this before posting an issue.

wj985712588 commented 6 years ago

the video media is Rotated when playing

xmedeko commented 6 years ago

This is a poor issue report. I repeat: read this before posting an issue. Have you tried it on another machine? What's the result in another video players WMP, MPC-HC, VLC, ...? Describe the video format, provide a link to video if you can. What codecs are used, see GraphStudioNext or debug this project.

Is it related to https://github.com/Nevcairiel/LAVFilters/issues/190 ?

wj985712588 commented 6 years ago

yeah,this issue is related to Nevcairiel/LAVFilters#190. the problem is happend on win10 machine wpf apps the win10 wmp player and other player such as potplayer ... is normal the video format is .mp4,it is Vertically shot on an Android phone i just use the LavFilters.

I guess that the reason may be the decoder(ffmpeg)

xmedeko commented 6 years ago

And what about any other DirectShow player, like MPC-HC (installed with K-Lite codecs)? If the MPC-HC plays it rotated, too, then it's a problem of the codec - LavFilters.

wj985712588 commented 6 years ago

the mpc-hc player performs normal

xmedeko commented 6 years ago

MPC-HC should use same codecs as WPF-MediaKit, but there may be some exceptions, since WPF-MediaKit tries to favour LAV Codecs. So you should check GraphStudioNext, what codecs are used by default - by MPC-HC. And then debug the WPF-MediaKit MediaUriPlayer.OpenSource() to see what codecs are used here.

Also, does other mp4 files plays well on your machine with WPF-MediaKit?

wj985712588 commented 6 years ago

when i play the same video with ffmpeg in cmd(ffplay ****.mp4),it performs normally. other mp4 file plays well with WPF-MediaKit

xmedeko commented 6 years ago

FFMpeg is another technology. Generally, Windows players uses three major technologies DirectShow, Windows Media Foundation and ffmpeg. The WPF-MediaKit is based on DirectShow. So you have to check WPF-MediaKit with other DirectShow players, e.g. the MPC-HC. If the MPC-HC plays the file well, then you have to check, what codecs it uses. see my previous post about GraphStudioNext (from K-Lite codecs, see Wiki).

xmedeko commented 6 years ago

Also. it seems to me you do not know much about DirectShow, the codecs and other stuff. Are you sure you want to use WPF-MediaKit and not the standard WPF MediaElement ?

wj985712588 commented 6 years ago

I think,the ghost windows system may not contain the Windows Media Player or Windows Media Center,so that the video or audio may not be played.

wj985712588 commented 6 years ago

Also, in my wpf apps and the system install k-lite codec pack,the video is also rotated.

xmedeko commented 6 years ago

In regards of WPF MediaElement: it uses Windows Media Foundation, like Windows Media Player, but does not Windows Media Player itself to be installed.

In regards of the video rotated in the WPF-MediaKit: you have to analyze real codecs used, see my 2 posts above.

wj985712588 commented 6 years ago

DirectShowUtil.AddFilterToGraph(m_graph, VideoDecoder, Guid.Empty); m_graph = {DirectShowLib.FilterGraphNoThread} VideoDecoder = "LAV Video Decoder"

xmedeko commented 6 years ago

Use MediaUriPlayer.DumpGraphInfo and GraphStudioNext.

wj985712588 commented 6 years ago

the method MediaUriPlayer.DumpGraphInfo(string fileName) is not Executed.

xmedeko commented 6 years ago

Yes, it isn't. You have to call it after the video is loaded (opened).

What about tu provide the video somewhere, as stated in read this before posting an issue.

xmedeko commented 6 years ago

I see from Nevcairiel/LAVFilters#190 that you have to use a renderer supporting rotation. Currently, WPF-MediaKit supports EVR or VMR9 renderers, try them both. I do not know if any of them supports rotation.