Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVAssetWriter unknown error

Am trying to create video from images using AVAssetWriter. Implemented code works fine most of time, but in random moments there is problem with writer

AVAssetWriter *videoWriter;
...
[videoWriter finishWriting];
NSLog(@"videoWriter error %@",videoWriter.error);

Received error is:

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" 
UserInfo=0x1f839cd0 {NSLocalizedDescription=The operation could not be completed,
 NSUnderlyingError=0x1e59efb0 "The operation couldn’t be completed. (OSStatus error -12633.)", 
NSLocalizedFailureReason=An unknown error occurred (-12633)}

Writing images:

-(void)writeFrame:(WriteableFrame*)wF
{
    if([writerInput isReadyForMoreMediaData])
    {
        CMTime presentTime = CMTimeMake(wF.frameTime, 1000);
        CGImageRef tmpImgRef = [wF.currentImage CGImage];
        buffer = [self pixelBufferFromCGImage:tmpImgRef];
        if(buffer)
        {
            [adaptor appendPixelBuffer:buffer withPresentationTime:presentTime];
            CVPixelBufferRelease(buffer);
        }
    }
    else
    {
        NSLog(@"error");
    }
}

Is there someone with problem like this?

like image 641
Ivan Alek Avatar asked Feb 25 '13 16:02

Ivan Alek


1 Answers

I found the problem, it was putting two frames at the same frame time.

like image 97
Ivan Alek Avatar answered Sep 17 '22 07:09

Ivan Alek