GPUImage2
GPUImage2 copied to clipboard
How to tell if filtering and saving a video has finished
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
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.
Thanks for looking into it. I also noticed that looping for video playback hasn't been fully implemented.
Is there any update on this?
@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
you change outputURL to solve this error