Hi, I'm writing an app that decodes a video, applies effects to each frame, then re-encodes to a new video. When I open both videos in FCPX to inspect, my source video is listed at 29.97 frames per second, while my re-encoded video is listed at 30 frames per second (making them incompatible to be swapped one for another in an FCPX timeline). I'm using the exact frame time stamps from the source video when encoding them to the destination video, so why is it incorrectly creating a 30 fps video from a 29.97 fps video? Key source code below:
When reading/decoding a frame:
CMSampleBufferRef videoSampleBuffer = [assetReaderVideoOutput copyNextSampleBuffer];
if (videoSampleBuffer == NULL)
return false;
CMSampleTimingInfo myTiming;
CMSampleBufferGetSampleTimingInfo(videoSampleBuffer, 0, &myTiming);
frameInfo->frameTimeValue = myTiming.presentationTimeStamp.value;
frameInfo->frameTimeScale = myTiming.presentationTimeStamp.timescale;
When writing/encoding the modified frame:
CMTime myTime = CMTimeMake(frameInfo->frameTimeValue, frameInfo->frameTimeScale);
[pixelBufferAdapter appendPixelBuffer:pixelsBuffer withPresentationTime:myTime];
Ideas?