CMVideoFormatDescriptionCreateFromH264ParameterSets问题

Zuk*_*jak 8 h.264 ios ios8

我试图创造CMVideoFormatDescriptionRefCMVideoFormatDescriptionCreateFromH264ParameterSets但它失败-12712错误(这似乎没有任何报头中定义)

我从avcC一个mov文件的原子(由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
Run Code Online (Sandbox Code Playgroud)

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

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

我已经在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);
Run Code Online (Sandbox Code Playgroud)

我每次都得到-12712(从几个文件和流中尝试了SPS/PPS).

你知道我做错了什么吗?(代码在模拟器上的Xcode6-Beta4上检查).我宁愿避免自己解析SPS和PPS并使用普通的CMVideoFormatDescriptionCreate :-)

sza*_*ary 12

不包括4字节大小.在sps/pps有效负载中,也不是大小值.