资源库兼容哪些视频格式?

发布于 2024-09-10 05:25:14 字数 156 浏览 4 评论 0原文

iPhone 的资源库兼容哪些视频格式?

换句话说,对于哪些视频格式,ALAssetsLibrary 的 videoAtPathIsCompatibleWithSavedPhotosAlbum 将返回 YES?

我似乎无法在 iPhone 参考库中找到任何相关信息。

What video formats are compatible with the iPhone's assets library?

In other words, for what video formats will ALAssetsLibrary's videoAtPathIsCompatibleWithSavedPhotosAlbum return YES?

I can't seem to locate any information on this in the iPhone Reference Library.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

旧街凉风 2024-09-17 05:25:14

目前还没有人提到这一点,但这取决于 iPhone/iOS 设备。在制作一个尝试将 Flickr 视频复制到相册的应用程序时,当我在 writeVideoAtPathToSavedPhotosAlbum: 调用非 Retina iPhone 上不断收到无效数据结果时,我感到很沮丧。

我按照这个问题的要求,对各种大小的 Flickr 视频运行了一些 videoAtPathIsCompatibleWithSavedPhotosAlbum 测试。

                                  iPhone        iPhone       iPad
                               (non-Retina)    (Retina)
6119419764_orig.mov
H.264, 1,920 x 1,080               NO             NO          NO
Linear PCM, 16 bit 
little-endian signed 
integer, 48000 Hz, 
Stereo (L R)
35.33 Mbit/s

6119419764_hd.mp4
AVC Coding, 1,280 x 720            NO             YES         YES
AAC, 44100 Hz, Stereo (L R)
2.15 Mbit/s

6119419764_site.mp4
AVC Coding, 640 x 360              NO             YES         YES
AAC, 44100 Hz, Stereo (L R)
833.71 kbit/s

6119419764_mobile.mp4
AVC Coding, 568 x 320              YES            YES         YES
AAC, 32000 Hz, Mono
775.14 kbit/s

6121206003_orig.mov
(Taken with iPhone 3Gs)           
H.264, 480 x 360                   YES            YES         YES
AAC, 44100 Hz, Mono
865.94 kbit/s
30 fps

6110638568_reformat.mov
H.264, 640 x 360                   YES            YES         YES
AAC, 44100 Hz, Mono
3.57 Mbit/s

根据这一有限的测试,对于给定的格式和设备,大小似乎最重要。 (对于当前的 Flickr 编码方法和 url 方案移动视频适用于所有 iOS 设备相册,而 hdsite 视频仅适用于 Retina iPhone和 iPad。)

一个有趣的旁注是,高清视频可以通过 MPMoviePlayerController 在非视网膜 iPhone 上播放 - 您只是无法将它们保存到相册中。

No one has mentioned this yet, but it depends on the iPhone / iOS device. In making an app that tries to copy Flickr videos to the photo album, I was getting frustrated when I kept getting invalid data results on writeVideoAtPathToSavedPhotosAlbum: calls for a non-Retina iPhone.

I ran some videoAtPathIsCompatibleWithSavedPhotosAlbum tests on Flickr videos of various sizes, as requested in this question.

                                  iPhone        iPhone       iPad
                               (non-Retina)    (Retina)
6119419764_orig.mov
H.264, 1,920 x 1,080               NO             NO          NO
Linear PCM, 16 bit 
little-endian signed 
integer, 48000 Hz, 
Stereo (L R)
35.33 Mbit/s

6119419764_hd.mp4
AVC Coding, 1,280 x 720            NO             YES         YES
AAC, 44100 Hz, Stereo (L R)
2.15 Mbit/s

6119419764_site.mp4
AVC Coding, 640 x 360              NO             YES         YES
AAC, 44100 Hz, Stereo (L R)
833.71 kbit/s

6119419764_mobile.mp4
AVC Coding, 568 x 320              YES            YES         YES
AAC, 32000 Hz, Mono
775.14 kbit/s

6121206003_orig.mov
(Taken with iPhone 3Gs)           
H.264, 480 x 360                   YES            YES         YES
AAC, 44100 Hz, Mono
865.94 kbit/s
30 fps

6110638568_reformat.mov
H.264, 640 x 360                   YES            YES         YES
AAC, 44100 Hz, Mono
3.57 Mbit/s

Based on this limited testing, for a given format and device, it looks like size matters most. (For the current Flickr encoding methods and url scheme, mobile videos work on all iOS device photo albums, whereas hd and site videos only work on Retina iPhones and iPads.)

An interesting side note is that HD videos will play on non-retina iPhones with the MPMoviePlayerController -- you just can't save them to the photo album.

墨洒年华 2024-09-17 05:25:14

如果您想要支持的音频/视频技术的列表,请阅读 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 帧,
    简单配置文件,AAC-LC 音频高达
    160 Kbps、48 kHz、立体声音频输入
    .m4v、.mp4 和 .mov 文件格式

  • 多种音频格式,包括“音频”中列出的格式
    技术”

这是iOS中媒体框架的参考信息。

If you want a list of supported audio/video technologies, read the iOS Technology Overview, in particular the Media Layer (scroll down to where it says "Video Technologies").

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”

That's the reference information for the media frameworks in iOS.

攒眉千度 2024-09-17 05:25:14

我最近在我的超快相机应用 SnappyCam Pro 中添加了视频导出功能,用于静态照片连拍。

为了满足新旧设备的需求,我最终创建了一些 MPEG-4“探测”视频,每个视频都有一个黑帧,具有各种 4:3 分辨率:

  1. 320x240px
  2. 640x480px
  3. 960x720px
  4. 1440x1080px

这四个视频文件仅添加了 12KB到应用程序包。

然后使用 -[ALAssetsLibrary videoAtPathIsCompatibleWithSavedPhotosAlbum:] 迭代每个选项,我就能够确定哪些选项对于最终相机胶卷视频导出有效。

I recently added a video export feature for the living photo burst of stills in my super-fast camera app SnappyCam Pro.

To cater for old and new devices alike, I ended up creating a few MPEG-4 "probe" videos, each with a single black frame, at a variety of 4:3 resolutions:

  1. 320x240px
  2. 640x480px
  3. 960x720px
  4. 1440x1080px

The four video files added just 12KB to the App Bundle.

By then iterating through each, with -[ALAssetsLibrary videoAtPathIsCompatibleWithSavedPhotosAlbum:], I was able to then work out which options are valid for the final Camera Roll video export.

木緿 2024-09-17 05:25:14

如果我必须猜测,我可能会使用 iPhone 自己的规格作为测试指南:

支持的视频格式:H.264 视频高达 720p、每秒 30 帧、Main Profile level 3.1,AAC-LC 音频高达 160 Kbps、48kHz、.m4v、.mp4 和 .mov 文件中的立体声音频格式; MPEG-4 视频,高达 2.5 Mbps,640 x 480 像素,每秒 30 帧,简单配置文件,AAC-LC 音频高达每通道 160 Kbps,48kHz,立体声音频采用 .m4v、.mp4 和 .mov 文件格式; Motion JPEG (M-JPEG) 高达 35 Mbps、1280 x 720 像素、每秒 30 帧、ulaw 音频、.avi 文件格式的 PCM 立体声音频

If I had to guess, I might use the iPhone's own specifications as a guideline for testing:

Video formats supported: H.264 video up to 720p, 30 frames per second, Main Profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, 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 per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

羅雙樹 2024-09-17 05:25:14

似乎没有记录的方法来查询什么格式将使 videoAtPathIsCompatibleWithSavedPhotosAlbum 满意,并且设备可以解码某种格式这一事实并不意味着 AssetLibrary 会接受它。 但是,您可能会期望配备相机的设备始终能够将相机的最高分辨率输出保存到相机胶卷中。

如果您可以接受这个假设,那么您所要做的就是枚举 AVCaptureDevices 并使用 supportsAVCaptureSessionPreset 查询各种预设。

维克多的测试表明像素面积似乎最重要,所以一旦你查询过
AVCaptureSessionPreset1920x1080、AVCaptureSessionPreset1280x720、AVCaptureSessionPreset640x480 您应该能够选择一个使 videoAtPathIsCompatibleWithSavedPhotosAlbum 说“是”的大小。

我不知道对于没有摄像头的设备你会如何计算。

There doesn't seem to be a documented way to query what formats will make videoAtPathIsCompatibleWithSavedPhotosAlbum happy and the fact that a device can decode a certain format doesn't mean the AssetLibrary will accept it. However, you would expect that a camera equipped device will always be able to save the camera's highest resolution output to the camera roll.

If you can live with this assumption, then all you have to do is enumerate the AVCaptureDevices and query the various presets with supportsAVCaptureSessionPreset.

Victor's tests show that pixel area seems to matter most, so once you've queried
AVCaptureSessionPreset1920x1080, AVCaptureSessionPreset1280x720, AVCaptureSessionPreset640x480 you should be able to choose a size that will make videoAtPathIsCompatibleWithSavedPhotosAlbum say YES.

I have no idea how you'd figure it for devices without cameras.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文