以编程方式访问iPhone视频的方向

以编程方式访问iPhone视频的方向,iphone,objective-c,video,orientation,Iphone,Objective C,Video,Orientation,我需要访问UIImagePickerController返回的视频,并知道它是纵向还是横向录制的。我看到了mov_read_tkhd的参考文献,但我不确定这是否能起到作用,也不确定如何包含必要的库 在iOS 4及以上版本上,使用3GS/3rd gen iTouch或更高版本,您可以使用新的AVFoundation库 比如: NSURL *url = // url to the video returned by the picker AVAssetTrack *videoTrack = [[ur

我需要访问UIImagePickerController返回的视频,并知道它是纵向还是横向录制的。我看到了mov_read_tkhd的参考文献,但我不确定这是否能起到作用,也不确定如何包含必要的库

在iOS 4及以上版本上,使用3GS/3rd gen iTouch或更高版本,您可以使用新的AVFoundation库

比如:

NSURL *url = // url to the video returned by the picker
AVAssetTrack *videoTrack = [[url tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
videoTrack.preferredTransform; // CGAffineTransform that tells you whether the video is rotated from original orientation
videoTrack.naturalSize; // CGSize that tells you the current dimensions of the video

在iOS 4及以上版本上,使用3GS/3rd gen iTouch或更高版本,您可以使用新的AVFoundation库

比如:

NSURL *url = // url to the video returned by the picker
AVAssetTrack *videoTrack = [[url tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
videoTrack.preferredTransform; // CGAffineTransform that tells you whether the video is rotated from original orientation
videoTrack.naturalSize; // CGSize that tells you the current dimensions of the video

谢谢-这个问题是在iOS4发布之前问的,但是我很感谢你的回答。我认为这在iOS3中是不可能的:反正我从来没有管理过它。不用担心-我遇到过这个搜索,一旦我们解决了它,我认为它值得填写,以防其他人发现它:)谢谢-这个问题在iOS3发布之前被问了一点,但我感谢你的回答。我认为这在iOS3中是不可能的:反正我从来没有管理过它。不用担心——我遇到了这个搜索,一旦我们解决了它,我认为它值得填写,以防其他人找到它:)