扩展AVMutableComposition [英] Extending an AVMutableComposition
本文介绍了扩展AVMutableComposition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在AVMutableComposition的末尾渲染一些图形,例如电影末尾的字幕.如何创建一个空白资产,该资产会延长合成时间,从而为我提供一些可以渲染的空白空间?
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?
推荐答案
我找到了答案.它位于insertEmptyTimeRange方法中.一个例子:
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];
这篇关于扩展AVMutableComposition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文