Jump to content
  • Advertisement
Sign in to follow this  
anilingamedev

Please suggest one method for video Mixing

This topic is 2810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!