Reputation: 4119
I would like to render some graphics to the end of my AVMutableComposition, like credits at the end of a movie. How can I create a blank asset that would extend the composition time to give me some blank space I can render to?
Upvotes: 3
Views: 1415
Reputation: 4119
I found the answer. It lies in the insertEmptyTimeRange method. An example:
//comp is an AVMutableComposition
float secondsToExtend = 5.0f;
long long timescale = comp.duration.timescale;
CMTime endTime = CMTimeMake(comp.duration.value - 1, timescale);
CMTime extendDuration = CMTimeMake(secondsToExtend * timescale, timescale);
CMTimeRange emptyTimeRange = CMTimeRangeMake(endTime, extendDuration);
[comp insertEmptyTimeRange:emptyTimeRange];
Upvotes: 3