Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Movies can be loaded into the framework via the GPUImageMovie class, filtered, and then written out using a GPUImageMovieWriter. GPUImageMovieWriter is also fast enough to record video in realtime from an iPhone 4's camera at 640x480, so a direct filtered video source can be fed into it.</p> <p>The following is an example of how you would load a sample movie, pass it through a pixellation and rotation filter, then record the result to disk as a 480 x 640 h.264 movie:</p> <pre><code>movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL]; pixellateFilter = [[GPUImagePixellateFilter alloc] init]; GPUImageRotationFilter *rotationFilter = [[GPUImageRotationFilter alloc] initWithRotation:kGPUImageRotateRight]; [movieFile addTarget:rotationFilter]; [rotationFilter addTarget:pixellateFilter]; 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 startRecording]; [movieFile startProcessing]; </code></pre> <p>Once recording is finished, you need to remove the movie recorder from the filter chain and close off the recording using code like the following:</p> <pre><code>[pixellateFilter removeTarget:movieWriter]; [movieWriter finishRecording]; </code></pre> <p>A movie won't be usable until it has been finished off, so if this is interrupted before this point, the recording will be lost.</p> <p>Here is good tutorial:</p> <p><a href="http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework" rel="nofollow">http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework</a></p> <p>See "Filtering and re-encoding a movie" section.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload