我正在尝试使用 iPhone 上的 UIImagePickerController 获取相机拍摄的视频的持续时间,有没有人找到解决方案?
谢谢
丹尼尔
您现在可以使用 AVFoundation 执行此操作,您可以将您的电影制作成 AVAsset,然后检查持续时间属性
Oh, why, hello hopelessly obsolete answer. I'm afraid you're only left here as historical evidence that yes, before iOS 4 if you wanted to do anything remotely interesting on a recorded video (besides playing it) you had to implement the processing yourself.
I don't know of any framework function to do so, so I'm afraid you'll have to parse the video container yourself (which by the way, is QuickTime/.mov) to extract this info. It's not like it's not documented. Luckily since the provider is known, you can trust all info to be truthful, which you can't assume of random videos found on the web.