I am pushing a new UIViewController after recording a movie with AVFoundation and AVCamRecorder.
Currently I'm playing the movie back from the URL the movie was saved at and that's working fine. I am having a huge bit of trouble understanding how to convert the video from the URL to an animated gif.
I'm pretty new to Objective C and had success creating a pretty custom video recorder, but now am discouraged on this next piece.
I have
SecondViewController.h
@interface SecondViewController : UIViewController
@property NSURL *videoURL;
@end
SecondViewController.m
#import "SecondViewController.h"
#import "FirstViewController.h"
#import "CaptureManager.h"
#import "AVCamRecorder.h"
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>
@interface SecondViewController ()
@property (nonatomic, strong) CaptureManager *grabFile;
@property (nonatomic, strong) MPMoviePlayerController *movie;
@end
@implementation SecondViewController
- (void)viewDidLoad
{
self.movie = [[MPMoviePlayerController alloc] initWithContentURL:self.videoURL];
_movie.view.frame = CGRectMake(0.0, 64.0, 320.0, 320.0);
_movie.movieSourceType = MPMovieSourceTypeFile;
_movie.repeatMode = MPMovieRepeatModeOne;
[self.view addSubview:_movie.view];
[_movie play];
}
I've tried a few things with
AVURLAsset
and
AVAssetImageGenerator
but I can't get far enough to output anything. I'd like to know the steps and if possible some example bits on how to extract the frames into an animated gif. Thanks for reading my question! :)