Save to disk ?

Feb 20, 2009 at 3:51 PM

First of all, you did a really impressing and extremely technical job !

I already use your projet to display various directshow source in a WPF application but I'd like to know if you can tell me a way to compress and save the stream.

There're some examples of that over the internet but i really don't know how to plug them into your solution.

Thanks in advance.

May 28, 2009 at 9:35 PM

I have a related question: I need to be able to save the current image to disk.  Is there a way to access the current image?  I cannot find it by looking through the WPF Element's properties/methods.




May 28, 2009 at 9:38 PM
Try looking at the RenderTargetBitmap class in WPF.  It can render any WPF visual to a bitmap, then you can save to disk.  There are many RTB examples on the internets.

Oct 8, 2009 at 8:15 PM
Edited Oct 8, 2009 at 8:20 PM

The RenderTargetBitmap class works fine if you don't scale your bitmap while showing it.

In my case I need the 'raw' source bitmap.

Therefore I changed the visibility of D3DRenderer.D3DImage to public and used the following function:


        public  RenderTargetBitmap GetBitmapOfVideoElement()
            DrawingVisual visual = new DrawingVisual();
            DrawingContext context = visual.RenderOpen();
            int w = videoElement.D3DImage.PixelWidth;
            int h = videoElement.D3DImage.PixelHeight;
            context.DrawImage(videoElement.D3DImage, new Rect(0,0,w,h));

            RenderTargetBitmap bitmap = new RenderTargetBitmap(w, h, 96, 96, PixelFormats.Default);

            return bitmap;


Is there a better way to get the source picture?