简体   繁体   English

获取相机iPhone SDK拍摄的视频的持续时间

[英]Getting duration of video taken by camera iphone sdk

I am trying to get the duration of a video taken with the camera using UIImagePickerController on the iphone, has anyone found a solution to this? 我正在尝试使用iphone上的UIImagePickerController用相机拍摄视频的持续时间,有人找到了解决方案吗?

Thanks 谢谢

Daniel 丹尼尔

您现在可以使用AVFoundation进行此操作,可以将电影制作为AVAsset,然后检查duration属性

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. 恐怕您只是留下来作为历史证据,是的,是的,在iOS 4之前,如果您想对录制的视频进行远程有趣的操作(除了播放),您必须自己实现处理。

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. 我不知道要执行此操作的任何框架函数,因此恐怕您必须自己解析视频容器(顺便说一下,它是QuickTime / .mov)以提取此信息。 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. 幸运的是,由于提供者是已知的,因此您可以相信所有信息都是真实的,而您无法假设自己在网络上发现了随机视频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM