                     return
                 }
                 
-                var image = CIImage(CVPixelBuffer: pixels)
+                var image = CIImage(cvPixelBuffer: pixels)
                 for filter in instruction.filters{
                   filter.setValue(image, forKey: kCIInputImageKey)
                   image = filter.outputImage ?? image

   
    // You may alter the value of kCVPixelBufferPixelFormatTypeKey to fit your needs
    var requiredPixelBufferAttributesForRenderContext: [String : Any] = [
        kCVPixelBufferPixelFormatTypeKey as String : NSNumber(unsignedInt: kCVPixelFormatType_32BGRA),
        kCVPixelBufferOpenGLESCompatibilityKey as String : NSNumber(bool: true),
        kCVPixelBufferOpenGLCompatibilityKey as String : NSNumber(bool: true)
    ]
    
    // You may alter the value of kCVPixelBufferPixelFormatTypeKey to fit your needs
    var sourcePixelBufferAttributes: [String : Any]? = [
        kCVPixelBufferPixelFormatTypeKey as String : NSNumber(unsignedInt: kCVPixelFormatType_32BGRA),
        kCVPixelBufferOpenGLESCompatibilityKey as String : NSNumber(bool: true),
        kCVPixelBufferOpenGLCompatibilityKey as String : NSNumber(bool: true)
    ]
    
    let renderQueue = dispatch_queue_create("com.jojodmo.videofilterexporter.renderingqueue", DISPATCH_QUEUE_SERIAL)
    let renderContextQueue = dispatch_queue_create("com.jojodmo.videofilterexporter.rendercontextqueue", DISPATCH_QUEUE_SERIAL)
    
    var renderContext: AVVideoCompositionRenderContext!
    override init(){
        super.init()
    }
    
    func startVideoCompositionRequest(request: AVAsynchronousVideoCompositionRequest){
        autoreleasepool(){
            dispatch_sync(self.renderQueue){
                guard let instruction = request.videoCompositionInstruction as? VideoFilterCompositionInstruction else{
                    request.finishWithError(NSError(domain: "jojodmo.com", code: 760, userInfo: nil))
                    return

                let newBuffer: CVPixelBuffer? = self.renderContext.newPixelBuffer()

                if let buffer = newBuffer{
                    instruction.context.render(image, to: buffer)
                    request.finish(withComposedVideoFrame: buffer)
                }
                else{
                    request.finish(withComposedVideoFrame: pixels)
                }
            }
        }
    }
    
    func renderContextChanged(newRenderContext: AVVideoCompositionRenderContext){
        self.renderContextQueue.sync{
            self.renderContext = newRenderContext
        }
    }
