我正在努力寻找有关如何使用
videoCompositionCoreAnimationToolWithAdditionalLayer
的任何文档。我一直在使用videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer
,但它不支持 HDR 视频。
如果有人可以提供一个例子,将不胜感激。
除了animationTool还需要添加图层指令
CMPersistentTrackID trackId = [asset unusedTrackID];
AVMutableVideoCompositionLayerInstruction* effectlayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstruction];
[effectlayerInstruction setTrackID: trackId];
[effectlayerInstruction setOpacity:1.0 atTime:kCMTimeZero];
videoInstruction.layerInstructions = @[effectlayerInstruction, videolayerInstruction]; //effectlayerInstruction should be first to not overlap by the video, make layer with bgColor clear
/// animationTool:
composition.animationTool = [AVVideoCompositionCoreAnimationTool videoCompositionCoreAnimationToolWithAdditionalLayer:layer asTrackID: trackId]; //trackId should be the same