Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
GPUImageMovie -> GPUImageMovieWriter audio sync and notification problem #830
My app is built with the latest GPUImage framework and Xcode 4.6, the latest iOS SDK and a target of iOS6.0. I build the GPUImage framework with a target of iOS5.1.
When I try to process a video file using GPUMovie -> GPUImageFilter -> GPUImageMovieWriter, often the last two pixelBuffers in the file throw an error, usually after an empty audio buffer is received.
When this happens, no didCompleteplayingMovie notification is generated at the end of file processing by GPUImageMovie, and no movieRecordingCompleted notification is generated at the end of file processing by GPUImageMovieWriter.
The problem only occurs if I have an audio track that is being synced while processing. Disregarding the audio eliminates the issue. When the audio is synced, at the time of the two pixel buffer errors near the end of the file, the audio buffers received have time=0 and timescale =0 but audio is still processing.
The issue does not occur for videos shot from the native camera app, only for videos shot with GPUImageMovieVideoCamera -> GPUImageFilter -> GPUImageMovieWriter within my app. These videos present and play properly outside my app in the native Photos app.
Here is what happens at the end of reading the file...
Then nothing... the movie has finished reading and writing but notifications are not generated. If I force the file to close at this point and play the recording, the video freezes one or two seconds early, and the audio plays to the end of the saved file.