none
[uwp] Using Win2D to create a frames or MediaClips in a MediaComposition to export it to a video file. RRS feed

  • Question

  • I created an app where users can draw something and create a video from those drawings. The language I used is C++/CX in combionation with Direct2D for drawing and MediaFoundation for creating a video. I am investigating if I can rewrite the functionality using C# and Win2D. This seems to work very good as Win2D is just a wrapper for Direct2D. Trying to create a video I got stuck. I tried using MediaComposition by creating MediaClips for every frame. When creating a MediaClip with the CreateFromSurface method, I supply a Win2D CanvasRenderTarget. I reuse the CanvasRenderTarget and it gets updated just before I create a new frame/MediaClip. When exporting the MediaComposition to a video, the frames in the resulting video all have the same image, which is the last update of the CanvasRenderTarget. Probably the MediaClips just get a reference to CanvasRenderTarget instead of a copy of the pixels of the CanvasRenderTarget.

    Is there a way how to use a Win2D CanvasRenderTarget as a source for frames to create videos? Is there a way using MediaComposition or the recently introduced screen capture framework in Windwos 10? As stated before, I want to try to use C# instead of C++/CX.


    Tuesday, July 17, 2018 12:39 PM