GPUImage
GPUImage copied to clipboard
Writing video issue - Looking for the cause
Writing video with GPUImage gives me following error in 30% of cases.
-[AVAssetWriter finishWritingWithCompletionHandler:] Cannot call method when status is 1
I guess, it may be connected to track duration, which is really short in my case, but may be not.
To start recording I do:
_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:_movieURL size:CGSizeMake(720.0, 1280.0)];
_movieWriter.encodingLiveVideo = YES;
[_cropFilter addTarget:_movieWriter];
_videoCamera.audioEncodingTarget = _movieWriter;
[_movieWriter startRecording];
To stop recording:
[_cropFilter removeTarget:_movieWriter];
_videoCamera.audioEncodingTarget = nil;
__weak typeof (self) welf = self;
[_movieWriter finishRecordingWithCompletionHandler:^{
[_videoCamera stopCameraCapture];
[_videoCamera removeAllTargets];
_videoCamera = nil;
[welf checkForAlbumAndSaveVideoAtURL:_movieURL];
_movieWriter = nil;
}];
Please, share any ideas on what can be causing the issue
PS Additionally when making extremely short recording (e.g. 1 sec) I get empty video files with yellow thumbnails (which is strange).