Extending an AVMutableComposition

荒凉一梦 提交于 2019-12-12 13:29:22

问题


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?


回答1:


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];


来源:https://stackoverflow.com/questions/7892664/extending-an-avmutablecomposition

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!