BradLarson / GPUImage2

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

How to tell if filtering and saving a video has finished #278

Open real19 opened 6 years ago

real19 commented 6 years ago

I have a video file that I am applying a filter to first , and then saving it. I am able to save the file, but I am trying to figure out when exactly the file is saved completely so like a completion handler or something where I can do cleanup etc and next steps. Any clues as to what I need to do?

`

       movie = try MovieInput(asset: AVAsset(url: movieURL!), playAtActualSpeed: false)

       output = try MovieOutput(URL: newURL, size: Size(width: 1920, height: 1080))

        movie --> filter --> output

        output.startRecording()

        movie.start()`

I can't find a delegate method or notification or some sort to tell me the video processing has been completed. Any help would be greatly appreciate.. Thanks

BradLarson commented 6 years ago

If you manually finish recording, you can use the finishRecording method on your MovieOutput to provide a callback block for when that has completed.

Unfortunately, in the case of playing from a static movie file, it looks like I haven't yet brought across the delegate I had in the original GPUImage that informs you about when the movie playback has finished. Let me see about adding that.

real19 commented 6 years ago

Thanks for looking into it. I also noticed that looping for video playback hasn't been fully implemented.

bkunarola commented 5 years ago

Is there any update on this?

Maxim-Appicstars commented 5 years ago

@BradLarson @real19 Hi, try to use the same code: ` let movie = try MovieInput(asset: AVAsset(url: sourceURL!), playAtActualSpeed: false)

        let output = try MovieOutput(URL: outputURL, size: Size(width: 720, height: 1280))

        movie --> output

        output.startRecording()
        movie.start()`

but get crash Fatal error: Unexpectedly found nil while unwrapping an Optional value in MovieOutput line 83 CVPixelBufferPoolCreatePixelBuffer(nil, self.assetWriterPixelBufferInput.pixelBufferPool!, &self.pixelBuffer)

Could you please, help to find my mistake

AliJohn2050 commented 4 years ago

you change outputURL to solve this error