How can two video streams be combined in C #?

In the past, I've used Managed Direct X and DirectShow.Net to play textured video on a simple mesh. I then used this same technique to combine multiple video sources into a single texture, using the various capabilities provided through the textures to combine these streams together. This was a very interesting experiment 2 years ago and was quite suitable for this purpose when Managed Dirext X was still being developed and supported (which is no longer the case) and similarly with DirectShow.Net - it looks like it hasn't been updated since July 2007.

I want to tamper with this space again and would like to know how this can be done in C #, without using a worn out or end of life API, and how best to approach it.

+2


source to share


5 answers


It's very easy to do this in WPF.

Use two MediaElements , one above the other, and make the top 50% transparent.



However, I don't think it is possible to save it in a new video

+3


source


you can use the open source SlimDX library which is almost the same as MDX and DirectShow and have support in Vista also in win7.0



+2


source


Another option I came across today might be AForge.net - it contains a namespace for video playback. http://www.aforgenet.com/framework/samples/video.html and published under the LGPL.

+1


source


An additional option is OpenTK; for mixing frames provided by the video stream: http://www.opentk.com/doc/graphics

+1


source


I did this around 2003. I had to use unsafe code, in other words, pointers to convert each frame of the COPIED image from the two video streams to RGB and average each pixel, then convert back to the original format. The performance degradation is so great if you don't use unsafe code. I understand that when working with a video stream, DirectShow does the magic by automatically aligning many codecs to do this. At the same time, these streams of images must be thread safe and properly synchronized, which means a lot of overhead. But someone who knows better should jump on it.

0


source







All Articles