AVMutableVideoComposition's frameDuration has no effect

Originator:mathieu
Number:rdar://11127156 Date Originated:27-Mar-2012 10:01 AM
Status:Duplicate/11112250 Resolved:
Product:iOS SDK Product Version:4.3 to 5.1
Classification:Other Bug Reproducible:Always
 
Summary:

Setting the AVMutableVideoComposition's frameDuration has no effect when exporting the video (using AVAssetExportSession).

I'm playing with the AVEditDemo project, from Apple's WWDC 2010 sample pack, and I'm trying to change the frame rate of the exported video. The video is exported using an AVMutableCompositionon which the frameDuration is set like that:

videoComposition.frameDuration = CMTimeMake(1, 30); // 30 fps

For some reason, changing the 30 to 25 does not change the framerate of the video exported with the AVAssetExportSession. Do you have an advice to help me solving this issue? I really need to be able to export a 25fps image…

Thanks in advance!



Steps to Reproduce:

- Download the AVEditDemo project from the WWDC 2010 Sample Test Code iOS.
- Open the project and go to the SimpleEditor.m file.
- Change this line:
videoComposition.frameDuration = CMTimeMake(1, 30); // 30 fps
into this line:
videoComposition.frameDuration = CMTimeMake(1, 25); // 25 fps
- Run the app in the simulator, select two clips, add a transition. Export the movie.
- Open the movie from the Finder, in QuickTime Player. Check the frame rate: it is 30 and not 25 fps! Argh…



Expected Results:

The generated movie should be running at 25fps.



Actual Results:

The generated movie runs at 30fps. According to an answer I got from Apple DTS (see bellow): "The current behavior is that the export preset's framerate takes precedence over the AVVideoComposition frameDuration during export." But in my humble opinion, as the ASExportSession doesn't allow to set the frame rate, it should not overwrite the setting from the composition.

This behaviour even brings visual glitches in some cases, for example : when incorporating images in the video which are supposed to follow a tracked object, the object's trajectory seems shaky. This is explained by: the CAKeyframeAnimation interpolates the new positions of the moving object, are not coherent with the position of the tracked object on the duplicated frames (duplicated because of the 25 to 30 frame transformation).



Regression:
n/a



Notes:
A support ticket has been open with the follow up number: XXXXXX.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!