title: How to add Image to video using GPUImage in Swift
body: <p>I have some codes to add image to video using GPUImage, but somehow it doesn't work as I thought. I have searched some solution, and still have this problem.<br>
  I'm trying to merge image when a recoding is done. Now the output is just a video not with image.<br>
  Here's my code.</p>
  
  <pre><code>override func viewDidLoad(){
     super.viewDidLoad
  
     setupCamera()
  }
  
  func setupCamera(){
      let myBoundSize: CGSize = UIScreen.mainScreen().bounds.size
  
      cameraSubPreview = GPUImageView(frame: CGRectMake(0, 0, myBoundSize.width, myBoundSize.height))
      cameraInput = GPUImageVideoCamera(sessionPreset: AVCaptureSessionPreset1280x720, cameraPosition: .Front)
      cameraInput.horizontallyMirrorFrontFacingCamera = true
      cameraInput.outputImageOrientation = .Portrait
  
      cameraInput.addTarget(mainVideoFilter)
  
      mainVideoFilter.addTarget(cameraSubPreview)
      cameraPreview.addSubview(cameraSubPreview)
      cameraInput.startCameraCapture()
  }
  
  func setupFilter(){
       let logoImageForGPU = GPUImagePicture(image: logoImageView.image)
  
       logoImageForGPU.addTarget(transformFilter)
       logoImageForGPU.processImage()
  
       // apply transform to filter
       let tx: CGFloat = logoImageView.frame.size.width
       let ty: CGFloat = logoImageView.frame.size.height
       print("tx and ty: \(tx), \(ty)")
       let t: CGAffineTransform = CGAffineTransformMakeScale(tx, ty);
       transformFilter.affineTransform = t
  
      transformFilter.addTarget(mainVideoFilter, atTextureLocation: 1)
  }
  
  func startRecordingVideo(sender: AnyObject) {
          if(sender.state == UIGestureRecognizerState.Began) {
              if !self.isRecording {
  
              setupFilter()
  
              let ud = NSUserDefaults.standardUserDefaults()
              var IntForFilePath : Int? = ud.objectForKey("IntForFilePath") as? Int
              if IntForFilePath == nil{
                  IntForFilePath = 10000
              }
  
              let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
              let documentsDirectory = paths[0]
              IntForFilePath = IntForFilePath! + 1
              let filePath : String? = "\(documentsDirectory)/temp\(IntForFilePath!).mp4"
              ud.setObject(IntForFilePath, forKey: "IntForFilePath")
              // URL.
              let fileURL : NSURL = NSURL(fileURLWithPath: filePath!)
  
              //print(filePath)
              self.delegate.filePathForVideo = filePath!
  
              movieWriter = GPUImageMovieWriter(movieURL: fileURL, size: CGSize(width: 480, height: 800))
              movieWriter.shouldPassthroughAudio = true
              //cameraInput.addTarget(stillImageFilter)
              //print("sif: \()")
              stillImageFilter.addTarget(movieWriter)
              cameraInput.audioEncodingTarget = movieWriter
  
              // start recording
              movieWriter.startRecording()
  
              circle.hidden = false
              drawCircleAnimation("strokeEnd", animeName: "updateGageAnimation", fromValue: 0.0, toValue: 1.0, duration: 10.0, repeat: 1, flag: false)
  
              self.isRecording = true
          }
      } else if (sender.state == UIGestureRecognizerState.Ended) {
          if self.isRecording {
              //stop recording
              movieWriter.finishRecording()
  
              stopCircleAnimation()
              self.isRecording = false
  
              self.moveToVideoSaveView()
          }
      }
  }
  </code></pre>
  
  <p>If you have any ideas could solve this, please let me know. <br>
  Thanks in advance.</p>