我正在创建一个可以处理视频文件的 iPhone 应用程序。我正在使用 AVFoundation 类(例如 AVAsset)。我刚刚将我的应用程序注册为所有符合 public.movie 文件的处理程序(通过 CFBundleDocumentTypes)。但是,现在我的应用程序列在 .avi
文件的“打开方式”菜单中,尽管我认为 iOS 无法播放 AVI 电影(Quick Look 预览会尝试,但失败)。
有没有更好的方式注册打开电影?我还需要支持文件共享,所以我需要区分 Documents 文件夹中的哪些文件也是有效的电影,尽管我还没有弄清楚如何检查文件的 UTI。 iOS Technology Overview说:
The video technologies in iOS support the playback of movie files with the .mov, .mp4, .m4v, and .3gp filename extensions and using the following compression standards:
- H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
- H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
- MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
- Numerous audio formats, including the ones listed in “Audio Technologies”
提前感谢您提供的任何提示。
最佳答案
仅对于视频,在 Info.plist 中指定以下 UTI 应该有效:
- com.apple.m4v-video (.m4v)
- com.apple.quicktime-movie (.qt, .mov)
- public.mpeg-4 (.mp4)
您可以在 AVMediaFormat.h 中找到 AVFoundation 支持的 UTI: https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVFoundation_Constants/Reference/reference.html%23//apple_ref/doc/uid/TP40009539-CH4g-DontLinkElementID_48
关于iphone - 视频格式、AVFoundation 和 UTI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4557426/