【发布时间】:2020-07-01 16:39:29
【问题描述】:
如何在AVVideoComposition 中实现等功率交叉淡入淡出?我正在使用类似以下的方法在视频轨道之间淡入淡出,但是当一遍又一遍地循环播放相同的视频时,由于setOpacityRamp 内部使用了任何曲线,因此在过渡期间会出现非常明显的亮度下降。
let videoInstruction = AVMutableVideoCompositionInstruction()
let fromLayerInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: fromCompositionTrack)
fromLayerInstruction.setOpacityRamp(fromStartOpacity: 1, toEndOpacity: 0, timeRange: timeRange)
let toLayerInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: toCompositionTrack)
toLayerInstruction.setOpacityRamp(fromStartOpacity: 0, toEndOpacity: 1, timeRange: timeRange)
videoInstruction.timeRange = timeRange
videoInstruction.layerInstructions = [fromLayerInstruction, toLayerInstruction]
【问题讨论】:
标签: ios swift avvideocomposition avcomposition