Stretch video of AxWindowsMediaPlayer without maintaining aspect ration in C#

孤街醉人 提交于 2019-12-01 08:27:26

问题


Using the AxWindowsMediaPlayer I need to stretch a video to take up the entire screen. The issue with stretchToFit = true, is that stretchToFit maintains the aspect ratio of the video, creating blackbars if the video or monitor is not of the same ratio. I do not want these black bars. I do not want to maintain the aspect ratio when I stretch the video.

I have been looking for an answer to this problem for a long time and have read countless questions posed by others. As far as I can tell, no one has any solution.

*I am posting this question despite there being an exact question already posted since the other question was posted a year ago with no answers.


回答1:


WMP doesn't allow stretching of the video without maintaining the aspect ratio.




回答2:


I do not want these black bars. I do not want to maintain the aspect ratio when I stretch the video.

Here's a solution! Even in Windows Media Player and AxWindowsMediaPlayer controls with K-Lite Codec Pack (MEGA PACK only, because it's the only pack which comes with ffdshow video decoder). In the K-Lite Codec Pack MEGA setup installation process select Advanced and go Next, IMPORTANT: in Preferred video decoder switch to ffdshow video decoder I also recommend you set ffdshow audio decoder, then proceed with Next until you finish installation, so now you have ffdshow video decoder installed and Windows Media Player also AxWindowsMediaPlayer controls will use it. After installation go to ffdshow video decoder configuration, you can locate it at:

Start Menu Folders > K-Lite Codec Pack\Configuration\ffdshow video decoder

Then tick the following settings:

So now videos will be rendered without keeping aspect ratio that will remove those "black bars" and get stretched to window.

EDIT: Just a reminder that a few video formats such as mkv will use by default the ffdshow video decoder in Windows Media Player and AxWindowsMediaPlayer components, other formats Windows 7/8.x/10 use its own codecs for decoding so for that reason you need to go to:

Start Menu Folders > K-Lite Codec Pack\Codec Tweak Tool

Then tick your desired settings, here's an example:

For more info about Media Foundation, take a look at: http://www.codecguide.com/windows7_preferred_filter_tweaker.htm



来源:https://stackoverflow.com/questions/15749181/stretch-video-of-axwindowsmediaplayer-without-maintaining-aspect-ration-in-c-sha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!