Search code examples
c#videodirectshowx264ffdshow

DirectShow IVideoWindow can't be wider than 4096px


I have a C# application which uses DirectShow to show play video clips. We recently tried to play a video that is 9600x1080 px and it would not show. DirectShow emits events that everything.

We use K-Lite codec pack (1295) and utilise ffdshow libx264 as codec and video renderer. Media Player Classic using the same renderer can play the clip just fine. The latest version of our application use DirectShow.NET while the older versions call DirectShow interfaces directly. Both old and new versions of our application have the same issues.

After some experimentation we have found out the following:

  • If the video window width is 4096px or narrower it will render video. If it is 4097 or wider it will not render any video. We tried playing a HD-clip and a 720-clip with the same results. They will play when the video window is 4096x1080 but not when the window is 4097x1080 or wider.

  • When changing resolution or graphic settings there are some flashes (a few frames) of the video when the settings is applied, so that would suggest that it is in fact playing the video but it displays only black.

Tested on Windows 10, 64 bit.

Any ideas of what the we can do to fix this?


Solution

  • The essential part is the video renderer you are using. Even though you did not mention, it is likely that you just use the defaults and this is a VMR-7 in windowed mode. This gets you an aged legacy component with limitations you are hitting.

    You are interested in updating your application to use EVR.

    Choosing the Right Video Renderer

    […]

    In Windows Vista and later, applications should use the EVR if the hardware supports it.

    […] methods use the VMR-7 by default. […] The EVR and VMR-9 are never the default renderers.