AVMutableComposition resizing issue

后端 未结 2 702
时光说笑
时光说笑 2021-02-19 23:10

I\'m trying to render an image into a video captured with the front camera using AVMutableComposition. The size of the resulting video (including the image) is

2条回答
  •  春和景丽
    2021-02-19 23:26

    Try applying a negative scale transform to flip the video when mirrored:

    // Create an AvmutableVideoCompositionLayerInstruction
    let videoLayerInstruction = AVMutableVideoCompositionLayerInstruction.init(assetTrack: videoTrack!)
    let flipped = videoAssetTrack.preferredTransform.scaledBy(x: -1.0, y: 1.0)
    videoLayerInstruction.setTransform(flipped, at: kCMTimeZero)
    compositionInstructions.layerInstructions = [videoLayerInstruction]    
    

提交回复
热议问题