How do I export UIImage array as a movie?

后端 未结 10 2007
臣服心动
臣服心动 2020-11-22 02:11

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.

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 02:38

    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

提交回复
热议问题