Can someone explain the original time, movie time, presentation time, etc.?

In my iOS application, I need to save the image as a short video segment. I have work using AVAssetWriter and AVAssetWriterPixelBufferAdaptor, thanks to some great posts on this site, but I had to lure out the start and end time of the session and the presentation time because I don't understand them.

The following snippet creates a 2 second video, but I set various times using trial and error. To be honest, I'm not sure why he is not creating a 3 second video.

// start session videoWriter.movieFragmentInterval = CMTimeMake(1,600); [videoWriter startWriting]; CMTime startTime = CMTimeMake(0, 600); [videoWriter startSessionAtSourceTime:startTime]; while (1) { if (![writerInput isReadyForMoreMediaData]) { NSLog(@"Not ready for data"); } else { [avAdaptor appendPixelBuffer:pixelBuffer withPresentationTime:CMTimeMake(1200,600)]; break; } } //Finish the session: [writerInput markAsFinished]; CMTime endTime = CMTimeMake(1800, 600); [videoWriter endSessionAtSourceTime:endTime]; [videoWriter finishWriting]; 

Can someone explain the various time settings in this snippet or point me to a document that will help? I read the apple documents until I crossed my eyes, but they require more knowledge than I do now, I think.

TIA: John

+4
source share

All Articles