Please suggest one method for video Mixing

Started by
2 comments, last by anilingamedev 13 years, 3 months ago
Hi

My video mixing requirement is as bellow.

1. I have 3 stream of video, each frame are of same size.
2. I have to mix each frame, pixel wise in the order as bellow

[ 1Pixe of 1st Frame ; 2ndPixel of 2nd Frame ; 3rd Pixel of 3rd Frame ].Then it will repeat again 1of1, 2of2, 3of 3 ....

With the above requirement I tried the options as bellow. [ Having less knowledge of direct X ]

1. Used VMR9 and IVMRMixerControl9 . In the derive class of IVMRMixerControl9
I got each frame data as surfce and try to do the above logic. in a FOR loop.

Result: 1. I got what I need, but rendering is SLOW.
2. When I did LockRect on each surface I get 8 bit pixel data not 32 bit pixel data data !!!

2. I tried with writing own VideoMixing Filter, but it is also SLOW when doing the above logic
in a loop for each pixel.

3. Never used Pixel shader but reading now to find out if pixel shader can meet the above requirement.

Want to know is my approach is correct and I should try more in these area. Or Is there any better or best way
that I can explore that will meet the requirement.

Please suggest some ideas.

Regards
Anil
Advertisement
Under the assumption that you are decoding all the videos fast enough, I'd go the pixel shader route.
Make 1 texture in RGBA that is your "mask". Make each of the RGB channels on that texture a mask for a video stream, where a value of white in that channel is "use a pixel" and a value of black is don't use it. So red is video 1's mask, blue is video 2's mask, green is video 3's mask.
Then make a pixel shader that takes in 4 textures (3 videos and the mask).
Make your final color something like color_out = mask.r/255 * video1.rgb + mask.b/255 * video2.rgb + mask.c/255 * video3.rgb;

Under the assumption that you are decoding all the videos fast enough, I'd go the pixel shader route.
Make 1 texture in RGBA that is your "mask". Make each of the RGB channels on that texture a mask for a video stream, where a value of white in that channel is "use a pixel" and a value of black is don't use it. So red is video 1's mask, blue is video 2's mask, green is video 3's mask.
Then make a pixel shader that takes in 4 textures (3 videos and the mask).
Make your final color something like color_out = mask.r/255 * video1.rgb + mask.b/255 * video2.rgb + mask.c/255 * video3.rgb;


Thank you very much for your reply.
I will study pixel shader in more detail then will try your suggestion.
Before studying just want to know if can be done or not ? Already spend lots of time reading and implementing the first two method...
Ok time to start pixel shader :blink:
Hope to get your help if i have any problem in future while implementing the above.:rolleyes:

Regards
Anil.
Hello

One more thing please.
Can you suggest any book or link that is describing how to use pixel shader in VMR9.

Regards
Anil.

This topic is closed to new replies.

Advertisement