我正在创建一个可以操作视频文件的 iPhone 应用程序。我正在使用 AVFoundation 类(例如 AVAsset)。我刚刚将我的应用程序注册为符合 public.movie 的所有文件的处理程序(通过 CFBundleDocumentTypes)。然而,现在我的应用程序列在 .avi
文件的“打开方式”菜单中,尽管我认为 iOS 无法播放 AVI 电影(“快速查看”预览会尝试,但会失败)。
有没有更好的注册打开电影的方法?我还需要支持文件共享,因此我需要区分文档文件夹中的哪些文件也是有效的电影,尽管我还没有弄清楚如何检查文件的 UTI。 iOS 技术概述 说:
iOS 中的视频技术支持播放具有 .mov、.mp4、.m4v 和 .3gp 文件扩展名并使用以下压缩标准的电影文件:
- H.264 视频,高达 1.5 Mbps、640 x 480 像素、每秒 30 帧、H.264 基线配置文件的低复杂度版本,AAC-LC 音频高达 160 Kbps、48 kHz、立体声音频输入.m4v、.mp4 和 .mov 文件格式
- H.264 视频,高达 768 Kbps、320 x 240 像素、每秒 30 帧,基线配置文件高达 1.3 级,AAC-LC 音频高达 160 Kbps、48 kHz,立体声音频格式为 .m4v、.mp4 、 和 .mov 文件格式
- MPEG-4 视频,高达 2.5 Mbps、640 x 480 像素、每秒 30 帧、Simple Profile,AAC-LC 音频高达 160 Kbps、48 kHz,立体声音频格式为 .m4v、.mp4 和 .mov文件格式
- 多种音频格式,包括“音频技术”中列出的格式
提前感谢您提供的任何提示。
I'm creating an iPhone app which can manipulate video files. I'm using AVFoundation classes (e.g., AVAsset). I just registered my application as a handler of all files conforming to public.movie (via CFBundleDocumentTypes). However, now my application is listed in the "Open With" menu for .avi
files, even though I don't think iOS can play AVI movies (the Quick Look preview will try, but fails).
Is there a better way to register to open movies? I will also need to support File Sharing, so I need to distinguish which files in the Documents folder are valid movies as well, though I haven't figured out how to check the UTI of a file. The iOS Technology Overview says:
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”
Thanks in advance for any tips you might have.
发布评论
评论(2)
仅对于视频,在 Info.plist 中指定以下 UTI 应该有效:
您可以在 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
For video only, specifying the following UTIs in the Info.plist should work:
You can find the UTIs supported by AVFoundation in AVMediaFormat.h:
https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVFoundation_Constants/Reference/reference.html%23//apple_ref/doc/uid/TP40009539-CH4g-DontLinkElementID_48
我决定处理此问题的最佳方法是使用 UT* 函数从文件扩展名获取 UTI 来确定文件的 UTI。不幸的是,这意味着 AVI 文件仍然会被导入,因为操作系统知道它们是电影,即使它们无法播放,但它似乎并没有造成太多问题。
I've decided the best way to handle this is to determine the UTI of a file using the UT* functions to get a UTI from a file extension. Unfortunately this means that AVI files are still imported, because the OS knows they're movies even though they can't be played, but it doesn't seem to be causing too many problems.