How do I export UIImage array as a movie?

Viewed 97505

I have a serious problem: I have an NSArray with several UIImage objects. What I now want to do, is create movie from those UIImages. But I don't have any idea how to do so.

I hope someone can help me or send me a code snippet which does something like I want.

Edit: For future reference - After applying the solution, if the video looks distorted, make sure the width of the images/area you are capturing is a multiple of 16. Found after many hours of struggle here:
Why does my movie from UIImages gets distorted?

Here is the complete solution (just ensure width is multiple of 16)
http://codethink.no-ip.org/wordpress/archives/673

9 Answers

For those still doing the journey in 2020, and getting distortion in their movies because its not width 16px

change

CGContextRef context = CGBitmapContextCreate(pxdata,
                                             width, height,
                                             8, 4 * width,
                                             rgbColorSpace,
                                             kCGImageAlphaNoneSkipFirst);

to

CGContextRef context = CGBitmapContextCreate(pxdata,
                                             width, height,
                                             8, CVPixelBufferGetBytesPerRow(pxbuffer),
                                             rgbColorSpace,
                                             kCGImageAlphaNoneSkipFirst);

Credit to @bluedays Output from AVAssetWriter (UIImages written to video) distorted

Related