hello i'm combining two videos with AVMutableVideoComposition() and it works good with landscape videos and portrait videos downloaded from youtube but when try portrait video recorded in iPhone or android the exported video comes as landscape/horizontal instead of original portrait/ vertical.
if researched lot on stack overflow and google but couldn't find any working solution.
this raywenderlich's article explains very well why video is in landscape mode and provides solution mathod in Orienting Video section of article, that first checks if video is portrait and then sets it's height width and preferredOrientation. but it doesn't work anymore.
i tried manually setting AVAssetTrack's .preferredTransform to CGAffineTransform(a: 0.0, b: 1.0, c: -1.0, d: 0.0, tx: 0.0, ty: 0.0) but doesn't work.
many old answer suggest setting AVAssetTrack's .preferredTransform to AvAsset's preferredTransform but it doesn't work.
from AVAssetTrack's .preferredTransform i'm able to know if video is portrait or not but not able to change it, any help will be really appreciated, thank you.