Video not rotating using AVMutableVideoCompositionLayerInstruction

后端 未结 3 2074
粉色の甜心
粉色の甜心 2021-02-06 12:42

I\'m trying to merge two videos I get after recording using the camera as a UIImagePickerController. I\'ve succeeded with combining the videos into one but I have some problems

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 13:09

    You can just use this simple code,It works for me:

      var assetVideoTrack = (sourceAsset.tracksWithMediaType(AVMediaTypeVideo)).last as! AVAssetTrack
    
      var compositionVideoTrack = (composition.tracksWithMediaType(AVMediaTypeVideo)).last as! AVMutableCompositionTrack
    
      if (assetVideoTrack.playable && compositionVideoTrack.playable) {
    
           compositionVideoTrack.preferredTransform = assetVideoTrack.preferredTransform
       }
    

提交回复
热议问题