以编程方式访问iPhone视频 [英] Programmatically access orientation of an iPhone video

查看:105
本文介绍了以编程方式访问iPhone视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要访问UIImagePickerController返回的视频,并知道它是纵向记录还是横向记录.我已经看到了对mov_read_tkhd的引用,但是我不确定这是否可以完成工作,或者不确定如何包括必要的库.

I need to access a video returned by the UIImagePickerController and know if it was recorded portrait or landscape. I've seen references to mov_read_tkhd but I'm not sure if that will do the job, or indeed how to include the necessary libraries.

推荐答案

在iOS 4及更高版本上,如果使用3GS/第三代iTouch或更高版本,则可以使用新的AVFoundation库.

On iOS 4 and above, with 3GS/3rd gen iTouch or better, you can use the new AVFoundation libraries.

类似的东西:

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

这篇关于以编程方式访问iPhone视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆