How to render 2 video streams using EVR?
By now my app can just play 1 stream using EVR. The usage is similar with using Windowless VMR9 filter.
I have read "Writing Custom Mixers and Presenters" on Vista Platform SDK Doc many times and search the relative topics using google. But I can't find out much information, specially about how to render 2 streams.
Who knows how to write a custom mixer, which interfaces should be called and their steps. Or tell me where has some materials on this knowledge?
[492 byte] By [
ximadyn] at [2007-12-28]
Hi,
Just to let you know (but you may probably already read my post on EVR), I tried to use the mixer with two streams. The problem is that for any other stream than the first one, it opens a new Window and doesn't mix anything at all. The fact is that using EVR in directshow mode lacks documentation with concrete samples.
Untill now, I'm still using the VMR9 under Vista. The main differences between VMR9 and EVR I found:
* with VMR9, my graph is notified when aspect ratio is changing. This way I can adapt the video window aspect ratio correctly. With the EVR, no aspect ratio notification. This is very curious because I guess this notification is thrown by the video decoder, and depending on the VideoRenderer, you get or don't get it.
* with VMR9, while playing a video, if you lock the session or try to change to another user, and get back to your session, your video window receive a WM_DISPLAYCHANGE event that we are supposed to manage by calling VRM9->Displaychange(). This is what I do, and when I get back to my session, there is no more video, just the sound. I have to remove the video renderer and add it to the graph to see the video back. With the EVR, this event doesn't need to be managed, and it works perfectly.
* At least, I noticed that using either the VRM9 or EVR under Vista is extremely dependant on the video card driver version you use. I have an NVidia 7800GTX graphic card, and since the last 3 versions I installed, a few things seems to have changed (in the right way). I guess these drivers, even WHQL, are pretty young for Vista and need to be investigated. And I supposed this is due to the use of DXVA2 from the video renderers.
So, I suggest everybody working on EVR should share its experience, because until there is a lot more in documentation, we are walking blind.
Regards,
Yeah, using VMR9 is easier to render 2 streams. The MS DirectShow sample MultiVMR finishes the job and has more features.
for EVR, lack documents and sample :(
Last serval days I tried to get some interfaces of default mixer, and just get 2 usefull IFs:IMFVideoMixerBitmap (render then set bitmaps) and IMFVideoMixerControl (get and set rect,z-order of one stream). But I wanna do more settings(e.g. Set Alpha of one stream...).
By now I can render 2 streams as follows:
1. use 2 source filters, 1 EVR, manually build filtergraph, create and connect filters one by one (e.g. spliter filter, video decode filter).
2. use IEVRFilterConfig::SetNumberOfStream() to set 2 streams (Input Pins) on EVR.
Then it can play 2 streams, but the color of sub stream is green and the sub stream is transparent. I don't know why! Maybe I lose some steps!
that's all my information, and you can try it :)
Hi,
Thanks for sharing your knowledge, as we seem to be a very few people trying to use EVR.
As you, what I'm able to do at the moment compared to VRM9, is to use IEVRFilerConfig and IMFVideoMixerBitmap (in order to display OSD while playing my video).
In fact, my application is a video player for RTP mpeg2 ts stream, and as I can receive two streams simultaneously, I decided to implement "Picture In Picture". Beside the ability to be able to watch these two streams (thanks to the VRM mixer), I felt into problems due to the use of accelerated hardware decoding. That would be too complicated to explain here and this is not the subject. But doing the same thing with EVR lead me to getting nervous :-) Indeed, I didn't find how to set the alpha of the streams, and also, as I already said, setting two input streams (like you did) open a new window to display the 2nd stream. May be I call the SetNumberOfStreams at the wrong place. But doing the same thing with VRM9 works like a charm. I'm surprised you succeed with this. I'm gona try again this week end. If I could make this works, I would only miss the SetAlpha and the aspect ratio events. Also, did you try to not call SetNumberOfStreams(2) and see what happen, because according to the documentation, this is the default number of streams for the EVR, as for the VRM9, it is 4 ?
Let's go deep inside the EVR :-)
By now I write the app of EVR compared to VMR9 too :)
I call SetNumberOfStreams after creating EVR. This function sets the number of input pin on EVR. When I do not call to SetNumberOfStreams, the app will only render one stream and I can get one input pin on EVR.
We can use GraphEdit to see the default number of streams on EVR and VMR9. As you know, while rendering media usingVMR9, it has 4 streams. But while using EVR, there is only one streams on EVR.
And according the Vista SDK documentation, It says "To add pins for substreams, query the filter IEVRFilterConfig interface and call IEVRFilterConfig::SetNumberOfStreams."
If you succeed, you will not be pleased for some problems :(
Now I'm trying to set alpha of sub stream and get the COM object(IMFTransform) of default mixer, but I have not gotten any more information.
I'm trying too to add alpha to the substream. So, if you could post any findings, I would be grateful! :)
I just happened upon this post and thought I would try to shed some light (with some assistance from the dev who wrote the EVR J).
1. The Issue of Two Streams: If you are going to mix two streams in the EVR, then as ximadyn pointed out, you should use the IEVRFilterConfig::SetNumberOfStream() interface. If the second stream is getting redirected to a new window, it is possible that the media type negotiation is failing, and if you are just calling RenderFile on the stream, it will get output to a new renderer instead (the default is VMR7). The color format used for sub streams is dependent on the reference stream, but if you make sure the sub stream is one of these four color formats, you should be fine: AI44, IA44, AYUV, or ARGB. The color formats supported by the graphics driver will also affect sub stream, so you will want to be aware of that. A quick way to see if this fixes what you are seeing, is to track the media type negotiation and make sure it succeeds so the EVR can accept it as a valid sub stream.
2. Aspect Ratio Change Events: Hm… this is a new one for us… we’ll dig into this one our end...
3. Setting Alpha: The EVR supports per-pixel alpha (it does not natively support planar alpha, but of course you can get planar behavior through per-pixel). See the comments above on acceptable sub stream color format types.
4. Custom Mixer: You shouldn’t need to use a custom mixer for any of the issues described here, but if you want to grab the mixer and wrap it, the mixer COM class GUID is:
DEFINE_GUID(CLSID_MFVideoMixer9,
0xE474E05A, 0xAB65, 0x4f6a, 0x82, 0x7C, 0x21, 0x8B, 0x1B, 0xAA, 0xF3, 0x1F);
// {E474E05A-AB65-4f6a-827C-218B1BAAF31F}
Eric
Also, re: GraphEdit:
If you regsvr32 the file evrprop.dll, you'll get property pages for the EVR in GraphEdit. Then you can try out EVR mixing in GraphEdit, just like you can for the VMR.
Evrprop.dll is located in the Bin directory of the Windows SDK for Vista.
-
Mike Wasson, SDK Documentation
This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.
(c) 2007 Microsoft Corporation. All rights reserved.
Thanks Microsoft Guys!!
As soon as I'll have some time, I'll try to update the MultiVRM9 sample to make a MultiEVR.
But before, it's time for questions:
Regarding the CLSID_MFVideoMixer9, where can we find interface description and how to use it ?
Do you plan to publish a sample demonstrating the EVR use in a DirectShow mode ?
Thanks.