- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这些简单的代码行(应用程序中没有任何其他内容)在 iOS 9(iPhone 6 和 iPhone 4S)上运行良好,但在 iOS 8(iPhone 5 和 iPod Touch 5G)上运行不正常:
VTCompressionSessionRef videoEncoder;
OSStatus err = VTCompressionSessionCreate(NULL, 1920, 1080,
kCMVideoCodecType_H264,
NULL,
NULL,
NULL,
NULL,
(__bridge void*)self, &videoEncoder);
if (err != noErr) {
NSLog(@"Error when creating compression session : %d", (int)err);
} else {
NSLog(@"All systems go!");
}
我也尝试过使用较低的分辨率,尝试提供部分或全部可选参数,在所有情况下它都适用于 iOS 9,但在 iOS 8 上失败并出现错误 -12902 (kVTParameterErr)。很高兴知道某些参数是错误的,但是哪个参数以及为什么它在 iOS 9 上不被认为是错误的?
请注意,VTCopyVideoEncoderList 确实为我提供了一个列表,其中在所有情况下都存在 avc1 (H264) 编码器。
知道发生了什么吗?
最佳答案
答案有点晚了,但我想它可能对其他人有用。对于 iOS 8
,您应该在创建压缩 session 时指定 VTCompressionOutputCallback outputCallback
。来自文档:
@param outputCallback
The callback to be called with compressed frames.
This function may be called asynchronously, on a different thread from the one that calls VTCompressionSessionEncodeFrame.
Pass NULL if and only if you will be calling VTCompressionSessionEncodeFrameWithOutputHandler for encoding frames.
反过来,VTCompressionSessionEncodeFrameWithOutputHandler
仅从 iOS 9
开始可用:
__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0)
关于ios - VTCompressionSessionCreate 适用于 iOS 9 但不适用于 iOS 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36004873/
当我想使用 VTCompressionSessionCreate 创建 VTCompressionSessionRef 时崩溃,谁能告诉我为什么????? dispatch_sync(aQueue,
这些简单的代码行(应用程序中没有任何其他内容)在 iOS 9(iPhone 6 和 iPhone 4S)上运行良好,但在 iOS 8(iPhone 5 和 iPod Touch 5G)上运行不正常:
我是一名优秀的程序员,十分优秀!