After applying an AVVideoComposition
to my AVPlayerItem
, the filter I apply does work, but the video gets rotated in the AVPlayerLayer
.
Try this code below which worked for me
// Grab the source track from AVURLAsset for example.
let assetV = YourAVASSET.tracks(withMediaType: AVMediaTypeVideo).last
// Grab the composition video track from AVMutableComposition you already made.
let compositionV = YourCompostion.tracks(withMediaType: AVMediaTypeVideo).last
// Apply the original transform.
if ((assetV != nil) && (compostionV != nil)) {
compostionV?.preferredTransform = (assetV?.preferredTransform)!
}
And then go ahead an export your video...