I am trying to capture a video of a XAML grid in UWP app using c#.
My approach.
1.Use RenderTargetBitmap to take a screenshot using renderTargetBitmap.RenderAsync
2.Convert the data to byte array.
3.Create an image file with the bytes and save it on disk using BitmapEncoder
4.Create a MediaClip from that image using MediaClip.CreateFromImageFileAsync
5.Add the clips to a MediaComposition composition.Clips.Add(clip)
6.Save as a video using composition.RenderToFileAsync(video);
Now this approach works.
But as you can imagine, going to disk to save the images and then read them to create the Clips, its SLOWWWW and the framerate is low.
I am looking for something that avoids going to the disk per each screenshot.
Something that converts a RenderTargetBitmap
(or IBuffer
or byte[]
) to MediaClip
s, without going to the disk, or some different approach to save the video.
I am developing UWP app for Hololens.