Trying this:
int frameCount = 30*10;
for(int i = 0; i<frameCount; i++)
{
while (!append_ok && j < 30)
{
if (self.adaptor.assetWriterInput.readyForMoreMediaData)
{
CMTime frameTime = CMTimeMake(i,(int32_t) 10);
NSLog(@"frameTime %f", CMTimeGetSeconds(frameTime));
append_ok = [self.adaptor appendPixelBuffer:buffer withPresentationTime:frameTime];
if(!append_ok){
NSError *error = self.assetWriter.error;
if(error!=nil) {
NSLog(@"Unresolved error %@,%@.", error, [error userInfo]);
}
}
[NSThread sleepForTimeInterval:0.05];
}
else
{
printf("adaptor not ready %d", j);
[NSThread sleepForTimeInterval:0.1];
}
j++;
}
if (!append_ok)
{
printf("error appending image times %d\n", j);
}
CVBufferRelease(buffer);
}
But I get this error:
MyApp(11658,0x3a98218c) malloc: * error for object 0x1782c690: double free
I just want to create a video with a 10 second duration, using a single image.