dimanche 25 janvier 2015

Transforming an Orientation of a video in AV Foundation portrait to display in a landscape setting

I made an editor in a landscape setting but when I import portrait clips onto a timeline they seem not still be sideways. Can anyone help me to get these clips to appear right side up like a square in landscape setting? I must be doing some transformation of the video wrong.



- (UIImageOrientation)getVideoOrientationFromAsset:(AVAssetTrack *)clipVideoTrack
{
CGSize size = [clipVideoTrack naturalSize];
CGAffineTransform txf = [clipVideoTrack preferredTransform];

if (size.width == txf.tx && size.height == txf.ty)
return UIImageOrientationLeft; //return UIInterfaceOrientationLandscapeLeft;
else if (txf.tx == 0 && txf.ty == 0)
return UIImageOrientationRight; //return UIInterfaceOrientationLandscapeRight;
else if (txf.tx == 0 && txf.ty == size.width)
return UIImageOrientationDown; //return UIInterfaceOrientationPortraitUpsideDown;
else
return UIImageOrientationUp; //return UIInterfaceOrientationPortrait;
}


portrait videos returning landscape every time.so it's hard to detect that this is portrait.


I don't this that all portrait videos have this issue.I think these videos are captured in portrait mode but visual representation is in Portrait. Does anyone know how to make this work?




Aucun commentaire:

Enregistrer un commentaire