简体   繁体   English

CMVideoFormatDescriptionCreateFromH264ParameterSets问题

[英]CMVideoFormatDescriptionCreateFromH264ParameterSets issues

I've tried creating CMVideoFormatDescriptionRef with CMVideoFormatDescriptionCreateFromH264ParameterSets but it fails with -12712 error (which does not seem to be defined in any header) 我尝试使用CMVideoFormatDescriptionCreateFromH264ParameterSets创建CMVideoFormatDescriptionRef ,但它失败并出现-12712错误(似乎没有在任何标头中定义)

I've taken my SPS and PPS from an avcC atom of a mov file (created by an iPhone camera app): 我从一个mov文件的avcC原子(由iPhone相机应用程序创建)中获取了我的SPS和PPS:

61 76 63 43 01 64 00 29 FF E1 00 10 67 64 00 29 AC 56 80 78 02 27 E5 9A 80
80 80 81 01 00 05 28 EE 04 F2 C0

SPS seems to be: 67 64 00 29 AC 56 80 78 02 27 E5 9A 80 80 80 81 SPS似乎是: 67 64 00 29 AC 56 80 78 02 27 E5 9A 80 80 80 81

...and the PPS: 28 EE 04 F2 C0 ......和PPS: 28 EE 04 F2 C0

I've preceeded SPS and PPS with their 4-byte lengths (tried also 1-byte and 2-byte lenghts with the same results) and issued the call like that: 我已经在SPS和PPS之前使用了4字节长度(尝试了1字节长度和2字节长度以及相同的结果)并发出了这样的调用:

uint8_t sps[] = {0x00, 0x00, 0x00, 0x10, 0x67, 0x64, 0x00, 0x29, 0xAC, 0x56, 0x80, 0x78, 0x02, 0x27, 0xE5, 0x9A, 0x80, 0x80, 0x80, 0x81};

uint8_t pps[] = {0x00, 0x00, 0x00, 0x05, 0x28, 0xEE, 0x04, 0xF2, 0xC0};

uint8_t* props[] = {sps, pps};

size_t sizes[] = {0x14, 0x09}; // sizes include the 4-byte length

CMVideoFormatDescriptionRef formatDesc;

OSStatus formatCreateResult = CMVideoFormatDescriptionCreateFromH264ParameterSets(NULL, 2, props, sizes, 4, &formatDesc);

I get -12712 as the result every single time (tried SPS / PPS from several files and streams). 我每次都得到-12712(从几个文件和流中尝试了SPS / PPS)。

Do you have any idea what do I do wrong ? 你知道我做错了什么吗? (The code was checked on Xcode6-Beta4 on Simulator). (代码在模拟器上的Xcode6-Beta4上检查)。 I'd prefer to avoid parsing SPS and PPS on my own and using plain CMVideoFormatDescriptionCreate :-) 我宁愿避免自己解析SPS和PPS并使用普通的CMVideoFormatDescriptionCreate :-)

Do not include the 4 byte size. 不包括4字节大小。 Either in the sps/pps payloads, nor the size values. 在sps / pps有效负载中,也不是大小值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM