Currently I am working on rendering two different videos at the same time using one VMR9 renderer and putting it on a XNA texture. The code I am currently using manages one video rendering however it does some cheesiness at two videos. On my working setup the complete video playing works flawlessly, but when I try to switch computers it gets me the black screen.
I am using a filter graph as suggested in this topic: Can one Video Mixing Renderer 9 (VMR9) render more video streams?
If I attach GraphStudioNext on the currently running program it displays the following graph: http://s11.postimg.org/z7d3qyyxf/graph.png
At first I tought the problem would be some differences between codec settings, but after I managed the same configuration on two different machines only the graphs changed: they became identical even though one machine displays the video correctly and the other just displays a black screen.
I even tried to remake the graph by hand to see if there is any problem with the graph itself and it runs smoothly.
I use the following code snippet to add the video sources to the VMR9 renderer:
protected override HRESULT OnInitInterfaces()
{
IBaseFilter bsFilter;
m_GraphBuilder.AddSourceFilter(@"video1.mp4", "first", out bsFilter);
IEnumPins ePins;
bsFilter.EnumPins(out ePins);
IPin[] pins = new IPin[1];
IntPtr fetched = IntPtr.Zero;
ePins.Next(1, pins, fetched);
int hr = m_GraphBuilder.Render(pins[0]);
m_GraphBuilder.AddSourceFilter(@"video2.mp4", "second", out bsFilter);
bsFilter.EnumPins(out ePins);
ePins.Next(1, pins, fetched);
hr = m_GraphBuilder.Render(pins[0]);
return (HRESULT)hr;
}
Any help would be appreciated.
The problem was with NVidia drivers. The following code snippet caused the error:
VMR9NormalizedRect r1 = new VMR9NormalizedRect(0, 0, 0.5f, 1);
VMR9NormalizedRect r2 = new VMR9NormalizedRect(0.5f, 0, 1, 1);
hr = (HRESULT)mix.SetOutputRect(0, ref r1);
hr = (HRESULT)mix.SetOutputRect(1, ref r2);
If a VMR9NormalizedRect gets initialized with any parameters apart from 0, 0, 1, 1 it will only display a black screen. The code runs perfect on any ATI card I tried.
It seems like that NVidia couldn't fix this error since 2006: https://forums.geforce.com/default/topic/358347/.