BradLarson / GPUImage3

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
BSD 3-Clause "New" or "Revised" License
2.68k stars 331 forks source link

MovieOutput outputs broken frame #70

Open b0o0d opened 4 years ago

b0o0d commented 4 years ago

Hi, @BradLarson , thanks for all you have been done. I'm a totally heavy user of GPUImage1-3. Recently, I ran into a problem that had been mentioned before:

https://github.com/BradLarson/GPUImage3/issues/44#issuecomment-511658802

As long as you make some work in examples > iOS > SimpleVideoRecorder, you can find it easily.

  1. in ViewController, make fileURL global

  2. import Photos library and add following codes in the movieOutput?.finishRecording block:

          PHPhotoLibrary.shared().performChanges({() -> Void in
                PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: self.fileURL)
          }, completionHandler: { _, error -> Void in
                do {
                    // delete the caches.
                    try FileManager.default.removeItem(at: self.fileURL)
                } catch {
                    print(error)
                }
            })
  3. add "Privacy - Photo Library Usage Description" in info.plist.

Then play the output video in Photos app, broken frames randomly show on the screen (in my case, I'm using iPhone6S with iOS 13.3.1, but the same result on the case that I cast the textures from filter to CVPixelBuffer).

Any help would be appreciated. Tanks in advance.