0

I'm trying to come up with a method of creating a video file (or even an animated gif), using a collection of BitmapImage in a Windows 10 application (UWP). I noticed that the mobile extensions have a ScreenCapture class (I'm not sure if that would do what I need anyway), but I need this to work on desktop as a minimum. I've had a play with the MediaCapture class, but am unable to find any methods that allow me to record images from the screen, or manipulate the video directly.

Windows.Media.Capture.MediaCapture mc = new Windows.Media.Capture.MediaCapture();
mc.StartRecordToStreamAsync()

Is what I'm trying to do possible using UWP in C#, and if so, how?

Paul Michaels
  • 16,185
  • 43
  • 146
  • 269

1 Answers1

3

You'll need MediaComposition API.

var composition = new MediaComposition();

Add clips (files)

composition.Clips.Add(await MediaClip.CreateFromImageFileAsync(someImageFile));

and in the end render to file

await composition.RenderToFileAsync(file);
Igor Ralic
  • 14,975
  • 4
  • 43
  • 51
  • @igor When I have many images, MediaClip.CreateFromImageFileAsync throws some randomly system.argument errors. Cannot create Clip. Here it shows another error. https://stackoverflow.com/questions/27341312/mediacomposition-rendertofileasync-crashes-with-many-static-images Do you have any idea how to fix it? – kkica Jun 21 '18 at 10:58