I have a small video clip in my iPhone Application on which I wish to carryout the following operations -
Since the video size is very small (less than a minute), all I can think of is converting the video into images by extracting each frames and then carry-out the above operations. Can anyone suggest a better idea?
Thanks
An easy an fast way to achieve these operations would be to use the GPUImage framework. You should be looking at the GPUImageMovie class in GPUImage to edit movies in iOS. The framework already comes with a set of filters that you can use to carry out the operations that you need. See this section for more details on how to edit videos using GPUImage.
In short, you first create a GPUImageMovie object:
movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
Then create some filters and apply the filters to the object.
cropFilter = [[GPUImageCropFilter alloc] init];
[movieFile addTarget:cropFilter];
You can add more filters in the chain by adding targets to the previousFilter in your chain. Finally, when you are ready to convert the video, do this:
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]);
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480.0, 640.0)];
[pixellateFilter addTarget:movieWriter];
movieWriter.shouldPassthroughAudio = YES;
movieFile.audioEncodingTarget = movieWriter;
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
[movieWriter startRecording];
[movieFile startProcessing]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With