开发者

Is it possible to programmatically create video frame-by-frame in iOS?

I want to make an app where users can create funny stick figure animations.

It would be cool if it is possible to export them as video. Can I "draw" video frame开发者_开发技巧s frame by frame and render them into a H.264 or other video format?

The length will be between 2 seconds and 5 minutes. I heared a while back that there is a framework to edit video but in my case I really need to create a video from scratch. What are my options?


You might need to use a multimedia framework which provides more lower level control, like gstreamer or ffmeg.

Alternately, you can create an MJPEG and figure out a way to transcode it.


Yes, you can examine : CEMovieMaker

Usage:

UIImage *frameImg = <Some Image>;

    NSDictionary *settings = [CEMovieMaker videoSettingsWithCodec:AVVideoCodecTypeH264
                                                        withWidth:source.size.width
                                                        andHeight:source.size.height
                              ];

    ///
    CEMovieMaker * movieMaker = [[CEMovieMaker alloc] initWithSettings:settings];


    /// Complete video
    [movieMaker createMovieFromImages:[self.movieImages copy] withCompletion:^(NSURL *fileURL){

        //AVPlayerViewController or
        MPMoviePlayerViewController *playerController = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
        [playerController.view setFrame:self.view.bounds];
        [self presentMoviePlayerViewControllerAnimated:playerController];
        [playerController.moviePlayer prepareToPlay];
        [playerController.moviePlayer play];
        [self.view addSubview:playerController.view];
    }];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜