Search code examples
iosimage-processingvideo-capturevideo-processing

iOS create video from array of images


I have an array of images that I am passing to this class:

https://github.com/jberlana/iOSKenBurns

This basically takes all of the images and builds a slideshow from them and then adds an automatic and random ken burns effect.

Everything works awesome; however, I am now trying to add the ability to export the slide show to a movie file. There will be just a simple button to accomplish this, but I have no idea where to start for turning this into a video.

I have found this: QTMovie Class Reference which is EXACTLY what I'm looking for (compile array of images into a movie file), but I need to retain the ken burns effect the class has added, and I don't know if this applied to iOS either.

Not really sure if this is even possible, or what to do with it. Any help would be great, at least a point in the right direction! Thanks in advance!


Solution

  • The QTMovie class does not function under iOS. You can take a look at an example Xcode project I created to show off this sort of movie composition logic in my library, the Xcode project is at AVRender. This example creates a lossless output file that basically contains all the images as frames of video. If you want to actually convert that to h.264 when finished, there is another example on that same page named AVDecodeEncode that shows how to do that and play the results with AVPlayer. You could also roll your own code to do all this using the AVAssets API under iOS, but be warned that those APIs are not simple to use.