在 iOS 上捕获视频时查询最佳像素格式?
AVFoundation 编程指南指出,捕获视频时的首选像素格式是:
- 对于 iPhone 4:
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
或kCVPixelFormatType_32BGRA
- iPhone 3G 的
:kCVPixelFormatType_422YpCbCr8
或 kCVPixelFormatType_32BGRA
(目前还没有针对 iPhone 5 的建议)或带摄像头的 iPad 设备。)
但是没有提供帮助我应该如何确定应用程序当前在什么设备上运行。如果首选像素格式在未来变得不同,从而导致我的应用程序未知设备发生变化,该怎么办?
确定任何设备的首选 YpCbCr 像素格式的正确且面向未来的方法是什么?
The AVFoundation Programming Guide states that the preferred pixel formats when capturing video are:
- for iPhone 4:
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
orkCVPixelFormatType_32BGRA
- for iPhone 3G:
kCVPixelFormatType_422YpCbCr8
orkCVPixelFormatType_32BGRA
(There are no recommendations [yet] for the iPhone 5 or for iPad devices with cameras.)
There is however no help provided as to how I should go about and determine what device the app is currently running on. And what if the preferred pixel format becomes different on a future and therefor to my app unknown device?
What is the correct, and future proof, way to determine the preferred YpCbCr pixel format for any device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信你可以将视频设置设置为零,AVFoundation 将使用最有效的格式。例如,
而不是执行此操作
您也可以尝试根本不设置它, 。我知道过去我会将其设置为零,除非我需要以特定格式捕获图像。
编辑
获取 AVFoundation 选择使用的格式。
I believe you can just set the video settings to nil and AVFoundation will use the most efficient format. For instance instead of doing
Do this instead
You may also try not setting it at all. I know in the past I would just set this to nil unless I needed to capture images in a specific format.
edit
To get the format AVFoundation chose to use.