title: Using CIFilter with AVFoundation (iOS)
body: <p>I am trying to apply filters to a video composition created with AVFoundation on iOS (filters could be, eg, blur, pixelate, sepia, etc). I need to both apply the effects in real-time and be able to render the composite video out to disk, but I'm happy to start with just one or the other.</p>
  
  <p>Unfortunately, I can't seem to figure this one out. Here's what I can do:</p>
  
  <ul>
  <li>I can add a layer for animation to the UIView that's playing the movie, but it's not clear to me if I can process the incoming video image this way.</li>
  <li>I can add an array of CIFilters to the AVPlayerLayer, but it turns out these are ignored in iOS (it only works on Mac OS X).</li>
  <li>I can add an AVVideoCompositionCoreAnimationTool to the AVVideoCompopsition, but I'm not sure this would accomplish video processing (rather than animation) and it crashes with a message about not being designed for real-time playback anyway. I believe this is the solution for rendering animation when rendering to disk.</li>
  </ul>
  
  <p>Other apps do this (I think), so I assume I'm missing something obvious.</p>
  
  <p>note: I've looked into GPUImage and I'd love to use it, but it just doesn't work well with movies, especially movies with audio. See for example:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/18349021/gpuimage-filters-in-runtime-on-avmutablecomposition">GPUImage filters in runtime on AVMutableComposition</a></li>
  <li><a href="https://github.com/BradLarson/GPUImage/issues/1339" rel="nofollow noreferrer">https://github.com/BradLarson/GPUImage/issues/1339</a></li>
  </ul>