AVFoundation variable to constant frame rate question

I want to know how AVFoundation handles variable frame rate compositions. I create an AVMutableComposition from a bunch of videos (most have variable frame rate as iPhone camera never shoots videos at constant frame rate), then assign an AVVideoComposition with a custom defined frameDuration. Then if I playback this composition or render it using AVAssetExportSession/AVAssetWriter, will the output always be a constant frame rate video and will AVPlayer play it as constant frame rate (perhaps by dropping frames)?

Also how do I specify frame rates such as 29.97 or 23.98 for rendering and playback?

Accepted Reply

Yes — frame rate conversion by dropping and/or holding frames.

Replies

Some video composition instructions are “tweened”, meaning that they produce different output at different times, even if the source frame did not change. So it’s important that those be rendered at all the multiples of the frameDuration. The video composition processor interrogates video composition instructions to see if each containsTweening to figure out whether this is necessary. If not, and if the frame duration of the composition is lower (= higher frame rate) than the source tracks, it may skip rendering, which you could think of as dropping frames — frames that would be duplicates anyhow.



The video composition processor interrogates video composition instructions to see if each containsTweening to figure out whether this is necessary. If not, and if the frame duration of the composition is lower (= higher frame rate) than the source tracks, it may skip rendering, which you could think of as dropping frames — frames that would be duplicates anyhow.

So in other words, if I understand you correctly, AVFoundation guarantees constant frame rate conversion for variable frame rate videos -- both in playback and rendering. Correct?
Yes — frame rate conversion by dropping and/or holding frames.