#iOS h264码流(十六进制)调试技巧

这里以相机采集到的数据流转换为h264裸流为例,这里对avcC转换为anex b格式为例,对原始流添加开始码以及spspps

部分代码

static const size_t startCodeLength = 4;
static const uint8_t startCode[] = {0x00, 0x00, 0x00, 0x01};

if (isIFrame) {
    CMFormatDescriptionRef description = CMSampleBufferGetFormatDescription(sampleBuffer);
    _self.formatDescription = description;
    size_t numberOfParameterSets;
    CMVideoFormatDescriptionGetH264ParameterSetAtIndex(description,
                                                       0, NULL, NULL,
                                                       &numberOfParameterSets,
                                                       NULL);
    
    for (int i = 0; i < numberOfParameterSets; i++) {
        const uint8_t *parameterSetPointer;
        size_t parameterSetLength;
        CMVideoFormatDescriptionGetH264ParameterSetAtIndex(description,
                                                           i,
                                                           &parameterSetPointer,
                                                           &parameterSetLength,
                                                           NULL, NULL);
        
        [elementaryStream appendBytes:startCode length:startCodeLength];
        [elementaryStream appendBytes:parameterSetPointer length:parameterSetLength];
        int a =22;
    }
}

这里在int a =22;一行打断点,这行代码无意义,就是为了能打上断点的。

打印描述信息

po description
显示出CMSampleBufferRef确实是avcc格式的

Printing description of description:
<CMVideoFormatDescription 0x17404b160 [0x1aaec2bb8]> {
    mediaType:'vide' 
    mediaSubType:'avc1' 
    mediaSpecific: {
        codecType: 'avc1'       dimensions: 640 x 480 
    } 
    extensions: {<CFBasicHash 0x174261300 [0x1aaec2bb8]>{type = immutable dict, count = 2,
entries =>
    0 : <CFString 0x1a526c1e0 [0x1aaec2bb8]>{contents = "SampleDescriptionExtensionAtoms"} = <CFBasicHash 0x1742612c0 [0x1aaec2bb8]>{type = immutable dict, count = 1,
entries =>
    2 : <CFString 0x1a5272380 [0x1aaec2bb8]>{contents = "avcC"} = <CFData 0x1740a77a0 [0x1aaec2bb8]>{length = 24, capacity = 24, bytes = 0x0142001effe100092742001eab40501ec801000428ce3c30}
}

    2 : <CFString 0x1a526c240 [0x1aaec2bb8]>{contents = "FormatName"} = H.264
}
}
}

for循环1:
parameterSetLength = 9
parameterSetPointer是一个指针,所以要选择View Memory Of *parameterSetPointer,parameterSetPointer里边的值是

2742001e ab40501e c8
030.gif

打印elementaryStream
注意:对NSData要输出里边的bytes内容,使用po [elementaryStream description]或者po elementaryStream均可。

(lldb) po [elementaryStream description]
<00000001 2742001e ab40501e c8>

for 循环2
parameterSetLength = 4
parameterSetPointer里边的值是
28ce3c 30
打印elementaryStream

(lldb) po elementaryStream
<00000001 2742001e ab40501e c8000000 0128ce3c 30>

bufferDataPointer内容为:

00 00 00 29 06 05 23 47 56 4A DC 5C 4C 43 3F 94 EF C5 11 3C D1 43 A8 00 00 03 00 00 03 00 02 8F 5C 28 01 FF CC CC FF 02 00 4C 4B 40 80 00 00 06 54 25 B8 20 02 FF FF FE 08 98 A0 00 20 CF EF 78 AD EE F3 F7 AB C5 CF DE FB EF BE FB EF BE FB D5 E2 EF 9F D5 EA 7D 5E F1 4C F8 90 FA BC BC FF AF 9F D5 F3 FE 9F 0A 02 81 A7 C4 00 FF 5E 2B 7D E2 7C F8 90 F7 BE 7C 2F 41 79 F5 A9 F1 5F 56 EB AC 56 B4 D6 AB 74 B4 B5 D7 5D 3A AE BA EB AD 57 5D 75 AA 71 75 C9 BB E9 55 13 4A AB A2 6B 1C A2 74 D7 5D 74 4D 74 E8 49 E9 CD 8B 75 D7 5D 6A 6E F4 A6 C5 D6 EB AE 9E BA EB AE B5 5D 75 AA D5 3B AE 95 D7 5D 6A B5 5A A5 A7 42 4E 45 2B AE BA 77 5C 8E A9 52 5B AD D7 5D 75 CC E0 D5 20 AF FF FD 05 FD 57 D1 DA C1 EB A7 75 BA E9 EB AE BA EB AE BA EB 54 AE 9E FA 57 4F 5D 75 D7 4E 84 9E BA EB 91 5B 4F 6A 93 25 23 A9 71 AB 15 AD D7 5A 6B A2 46 59 3C 1F 60 92 7D 26 AF 55 BA 7A EB AE BA EF 55 D2 D7 7A A5 74 F7 CA AD 32 6D 6D 6D 66 71 94 2F 56 C4 BA EF 93 6C 8A 42 2D 6D 4E 41 7B AE B7 5D 75 DA DA AB 5A D5 6A BA 7A EB AE BA EB BC 98 FB 5B 26 D6 D5 03 6A 81 B5 21 16 B6 B6 AE D4 56 DC 4B 84 DD 75 D7 5B AC B8 FB DA 79 F1 75 BA EB AD 56 2E FB EF BE B7 4A 5C 6F 7D F7 CF DA FB CF 8C 9B 5B D2 79 71 F7 9F 0F DA D6 D6 F9 BB 57 6F 5D 75 DF 5D 75 D7 5D 6E BA EB 57 AB EF BE FB EB A5 74 B4 B4 B5 D7 5D 75 BA C5 6B AE BA 5A 5A 5A 5A 5A 5A E6 ED 5D 3D 75 D7 5C DD AB AE BB EB 3F 5D 75 BA EB 75 BA C5 6F BE 5E FB EF BD A7 9F 1F 5D 75 D7 5D 75 D7 5D 75 D3 D7 4B 4B 4F 37 6A 5A EB 2E 3E B9 BB 5F 6F 7D F7 AB EF AE BA EB AE B9 BB 57 4F 5D 75 D7 5D 75 9B 1F 7D F7 D7 4B 4B 4B 4B

对此sample进行解析

   size_t blockBufferLength;
    uint8_t *bufferDataPointer = NULL;
    CMBlockBufferGetDataPointer(CMSampleBufferGetDataBuffer(sampleBuffer),
                                0,
                                NULL,
                                &blockBufferLength,
                                (char **)&bufferDataPointer);
    
    size_t bufferOffset = 0;
    static const int AVCCHeaderLength = 4;
    while (bufferOffset < blockBufferLength - AVCCHeaderLength) {
        uint32_t NALUnitLength = 0;
        memcpy(&NALUnitLength, bufferDataPointer + bufferOffset, AVCCHeaderLength);
        NALUnitLength = CFSwapInt32BigToHost(NALUnitLength);
        [elementaryStream appendBytes:startCode length:startCodeLength];
        [elementaryStream appendBytes:bufferDataPointer + bufferOffset + AVCCHeaderLength
                               length:NALUnitLength];
        bufferOffset += AVCCHeaderLength + NALUnitLength;
    }

blockBufferLength = 1669
while 1
NALUnitLength = 41
对应的NALU

060523 47564adc 5c4c433f 94efc511 3cd143a8 00000300 00030002 8f5c2801 ffccccff 02004c4b 4080

while2
NALUnitLength = 1620
对应的NALU

25b8 2002ffff fe0898a0 0020cfef 78adeef3 f7abc5cf defbefbe fbefbefb d5e2ef9f d5ea7d5e f14cf890 fabcbcff af9fd5f3 fe9f0a02 81a7c400 ff5e2b7d e27cf890 f7be7c2f 4179f5a9 f15f56eb ac56b4d6 ab74b4b5 d75d3aae baebad57 5d75aa71 75c9bbe9 55134aab a26b1ca2 74d75d74 4d74e849 e9cd8b75 d75d6a6e f4a6c5d6 ebae9eba ebaeb55d 75aad53b ae95d75d 6ab55aa5 a7424e45 2baeba77 5c8ea952 5badd75d 75cce0d5 20affffd 05fd57d1 dac1eba7 75bae9eb aebaebae baeb54ae 9efa574f 5d75d74e 849ebaeb 915b4f6a 932523a9 71ab15ad d75a6ba2 46593c1f 60927d26 af55ba7a ebaebaef 55d2d77a a574f7ca ad326d6d 6d667194 2f56c4ba ef936c8a 422d6d4e 417baeb7 5d75dada ab5ad56a ba7aebae baebbc98 fb5b26d6 d5036a81 b52116b6 b6aed456 dc4b84dd 75d75bac b8fbda79 f175baeb ad562efb efbeb74a 5c6f7df7 cfdafbcf 8c9b5bd2 7971f79f 0fdad6d6 f9bb576f 5d75df5d 75d75d6e baeb57ab efbefbeb a574b4b4 b5d75d75 bac56bae ba5a5a5a 5a5a5ae6 ed5d3d75 d75cddab aebbeb3f 5d75baeb 75bac56f be5efbef bda79f1f 5d75d75d 75d75d75 d3d74b4b 4f376a5a eb2e3eb9 bb5f6f7d f7abefae baebaeb9 bb574f5d 75d75d75 9b1f7df7 d74b4b4b 4b59b1ad adad6ab3 62eb9b36 3df7abd5 e2ef9793 69ed3da7 de7c5d2d 285eaf93 befbefbe baebaebb ebaebaeb 75d6eb75 8a6b97a5 362c2f64 7d5ec956 aa55b5b5 b5956d64 dd72f5d7 377b5a7a ebaebaeb aeb362dd 6ebaebae fbefbeba ddeeb05d 2404eb47 655176b3 ab556b22 b4257d6b 4b4b4e45 2b2f7d75 d3aae9d5 75d75d75 ff97fe23 5faaf4b3 a85ec87d 360ad21d 6e5c5d75 d75d75d7 5a6b758a cdde675a a59955e9 45fff97d 0675d7d4 ea3ccf2b 2451a51e 64d4d8f1 940b54f5 d75d3aae f75d75d7 377a7892 66a6ccdb d38c2653 d75d75d7 5d75d645 2fae8999 d7a9dd3a acacf6e5 0eddad7a d7af51b8 c71f5984 8175471a 6cbb355e d46d0c14 2483014b 41fff4fe c1277bd9 234ad445 495c3028 27aebae9 c5d74aeb aebae96b ffffe1ef 76aa6715 b575cdda ba7aebae baebae9e 9d539fa7 55a625c4 9f4bffd2 1f0b9d75 ae3e3b2e 0dbe290c 0cb40965 d08ce216 1e9ebae6 ef5d75ba ebaebaeb a775a49e bae9eba7 aebaebad 575d3cce b5593a75 27292167 2133892c 3894003f fb09f7dd e2490fd0 e9118e44 c484bab0 b4ce3b46 a7aeba25 8975d74b 4f5d75d6 ed5daa4d 4bd75d3d 74f5d75d 75d75d3d 3aadb338 74cb55bc 56141425 fea66709 84cf3e9f 095abd99 a270ed08 9642425a ad09985e a2492fea 7aeba73a 85d6abbd a2aa35d7 5d75bac5 6faeba7a e9ebaeb5 59b175d7 4f4e6cfd 7262fcde aaabaaa8 2f04312a 243ef124 82b6915f c3ff823e b8b62c87 a20c4c58 406aafd5 f8fcfaf3 cc3d53fc 00a7fec1 2f5d4412 6d699989 bd124fd4 e45d75d3 d73fa9d4 0b3aa59e 25494aff ff4a053d 77e291cb d75d75de ebaeba7a e9ebaeb1 21e7cd8f 5b12eba7 99c2ca67 5339a553 b3807ba1 50447426 60b9b1d1 2e3b84cb d6b8ff41 7d7a4f8f d578c545 579068d4 bbf4a96b 6ff8e271 f32abc10 1aab6a5a 09662f6a 70a82a9c ebaeba7a eb373385 a84f3a8e e44489c9 17257aeb aebadd6a bae9eba7 aeb55a4f 21159d42 eb54f10e 3f894460 a9709969 c91b686b 24a41124 869ef131 22bcbfa7 ff0afbbf 6a07f294 91477be5 8f2e415b fbeef360 b3a1ea7a eba7aed5 cf88916b 5261d443 fa9db5d7 5d75deeb ae89ae9e baef263d a5b6bad5 3ceebd22 bbd27a47 5f576a5c 6a81b529 04eac1b4 8e145027 3f5d74f7 931e7c4b 4ae6cfda faebadd6 5c7de7c5 d75d74f5 d75d7277 baeb1957 d936b6a5 209ffac9 956d5dab 89ca41e8 8515b56a bae95091 25c7b4f3 e3ebacb8 f3e3efae baebaeb9 bbd75d75 d7593175 df2abb5b 5b5b25a7 9f1e5c7d f4b5deeb aefacb8b aeb2e3eb aebaebae baebaeba 7aebaeba dd62b376 a5b26def be5ef697 5d77df7c dda96969 efbeb9bb 5135d744 d2d2d2d7 5d75d744 d75d75df 4b44d2aa 755aaeba ebaebaeb ae96b9bb d75d75d2 d2d2d737 7a269696 96baebae 6ef4f5d7 5d72f5aa c5df7df7 bbddeeb5 5d6ab55a ae96b55a aebaebae ba5aebae bae969eb 9bbd74b4 b44d75ba db585cab d5e620bc a417df5d 77df7dee b55d75aa c5d6abae baebaeba ebaeb55d 3d74f5d7 5d75bac5 6b1566c5 ded69695 53d73f7b dd6abaeb 75d75d66 ebbefbdd 6abaebae baebaeba eba7aeba ebadd75d 135d6eba eb74aeb1 5aebaeb2 f5d75cbd 75d75d6a baebaeba ebaebaeb a26baeb9 bb60

此时数据为

(lldb) po elementaryStream
<00000001 2742001e ab40501e c8000000 0128ce3c 30000000 01060523 47564adc 5c4c433f 94efc511 3cd143a8 00000300 00030002 8f5c2801 ffccccff 02004c4b 40800000 000125b8 2002ffff fe0898a0 0020cfef 78adeef3 f7abc5cf defbefbe fbefbefb d5e2ef9f d5ea7d5e f14cf890 fabcbcff af9fd5f3 fe9f0a02 81a7c400 ff5e2b7d e27cf890 f7be7c2f 4179f5a9 f15f56eb ac56b4d6 ab74b4b5 d75d3aae baebad57 5d75aa71 75c9bbe9 55134aab a26b1ca2 74d75d74 4d74e849 e9cd8b75 d75d6a6e f4a6c5d6 ebae9eba ebaeb55d 75aad53b ae95d75d 6ab55aa5 a7424e45 2baeba77 5c8ea952 5badd75d 75cce0d5 20affffd 05fd57d1 dac1eba7 75bae9eb aebaebae baeb54ae 9efa574f 5d75d74e 849ebaeb 915b4f6a 932523a9 71ab15ad d75a6ba2 46593c1f 60927d26 af55ba7a ebaebaef 55d2d77a a574f7ca ad326d6d 6d667194 2f56c4ba ef936c8a 422d6d4e 417baeb7 5d75dada ab5ad56a ba7aebae baebbc98 fb5b26d6 d5036a81 b52116b6 b6aed456 dc4b84dd 75d75bac b8fbda79 f175baeb ad562efb efbeb74a 5c6f7df7 cfdafbcf 8c9b5bd2 7971f79f 0fdad6d6 f9bb576f 5d75df5d 75d75d6e baeb57ab efbefbeb a574b4b4 b5d75d75 bac56bae ba5a5a5a 5a5a5ae6 ed5d3d75 d75cddab aebbeb3f 5d75baeb 75bac56f be5efbef bda79f1f 5d75d75d 75d75d75 d3d74b4b 4f376a5a eb2e3eb9 bb5f6f7d f7abefae baebaeb9 bb574f5d 75d75d75 9b1f7df7 d74b4b4b 4b59b1ad adad6ab3 62eb9b36 3df7abd5 e2ef9793 69ed3da7 de7c5d2d 285eaf93 befbefbe baebaebb ebaebaeb 75d6eb75 8a6b97a5 362c2f64 7d5ec956 aa55b5b5 b5956d64 dd72f5d7 377b5a7a ebaebaeb aeb362dd 6ebaebae fbefbeba ddeeb05d 2404eb47 655176b3 ab556b22 b4257d6b 4b4b4e45 2b2f7d75 d3aae9d5 75d75d75 ff97fe23 5faaf4b3 a85ec87d 360ad21d 6e5c5d75 d75d75d7 5a6b758a cdde675a a59955e9 45fff97d 0675d7d4 ea3ccf2b 2451a51e 64d4d8f1 940b54f5 d75d3aae f75d75d7 377a7892 66a6ccdb d38c2653 d75d75d7 5d75d645 2fae8999 d7a9dd3a acacf6e5 0eddad7a d7af51b8 c71f5984 8175471a 6cbb355e d46d0c14 2483014b 41fff4fe c1277bd9 234ad445 495c3028 27aebae9 c5d74aeb aebae96b ffffe1ef 76aa6715 b575cdda ba7aebae baebae9e 9d539fa7 55a625c4 9f4bffd2 1f0b9d75 ae3e3b2e 0dbe290c 0cb40965 d08ce216 1e9ebae6 ef5d75ba ebaebaeb a775a49e bae9eba7 aebaebad 575d3cce b5593a75 27292167 2133892c 3894003f fb09f7dd e2490fd0 e9118e44 c484bab0 b4ce3b46 a7aeba25 8975d74b 4f5d75d6 ed5daa4d 4bd75d3d 74f5d75d 75d75d3d 3aadb338 74cb55bc 56141425 fea66709 84cf3e9f 095abd99 a270ed08 9642425a ad09985e a2492fea 7aeba73a 85d6abbd a2aa35d7 5d75bac5 6faeba7a e9ebaeb5 59b175d7 4f4e6cfd 7262fcde aaabaaa8 2f04312a 243ef124 82b6915f c3ff823e b8b62c87 a20c4c58 406aafd5 f8fcfaf3 cc3d53fc 00a7fec1 2f5d4412 6d699989 bd124fd4 e45d75d3 d73fa9d4 0b3aa59e 25494aff ff4a053d 77e291cb d75d75de ebaeba7a e9ebaeb1 21e7cd8f 5b12eba7 99c2ca67 5339a553 b3807ba1 50447426 60b9b1d1 2e3b84cb d6b8ff41 7d7a4f8f d578c545 579068d4 bbf4a96b 6ff8e271 f32abc10 1aab6a5a 09662f6a 70a82a9c ebaeba7a eb373385 a84f3a8e e44489c9 17257aeb aebadd6a bae9eba7 aeb55a4f 21159d42 eb54f10e 3f894460 a9709969 c91b686b 24a41124 869ef131 22bcbfa7 ff0afbbf 6a07f294 91477be5 8f2e415b fbeef360 b3a1ea7a eba7aed5 cf88916b 5261d443 fa9db5d7 5d75deeb ae89ae9e baef263d a5b6bad5 3ceebd22 bbd27a47 5f576a5c 6a81b529 04eac1b4 8e145027 3f5d74f7 931e7c4b 4ae6cfda faebadd6 5c7de7c5 d75d74f5 d75d7277 baeb1957 d936b6a5 209ffac9 956d5dab 89ca41e8 8515b56a bae95091 25c7b4f3 e3ebacb8 f3e3efae baebaeb9 bbd75d75 d7593175 df2abb5b 5b5b25a7 9f1e5c7d f4b5deeb aefacb8b aeb2e3eb aebaebae baebaeba 7aebaeba dd62b376 a5b26def be5ef697 5d77df7c dda96969 efbeb9bb 5135d744 d2d2d2d7 5d75d744 d75d75df 4b44d2aa 755aaeba ebaebaeb ae96b9bb d75d75d2 d2d2d737 7a269696 96baebae 6ef4f5d7 5d72f5aa c5df7df7 bbddeeb5 5d6ab55a ae96b55a aebaebae ba5aebae bae969eb 9bbd74b4 b44d75ba db585cab d5e620bc a417df5d 77df7dee b55d75aa c5d6abae baebaeba ebaeb55d 3d74f5d7 5d75bac5 6b1566c5 ded69695 53d73f7b dd6abaeb 75d75d66 ebbefbdd 6abaebae baebaeba eba7aeba ebadd75d 135d6eba eb74aeb1 5aebaeb2 f5d75cbd 75d75d6a baebaeba ebaebaeb a26baeb9 bb60>

对应的

2017-03-01 17:50:28.131957 ACCleanStream2[4845:1443256] NALU with Type "Sequence parameter set (non-VCL)" received. code (7)
2017-03-01 17:50:34.266501 ACCleanStream2[4845:1443256] NALU with Type "Picture parameter set (non-VCL)" received. code (8)
2017-03-01 17:50:36.281084 ACCleanStream2[4845:1443256] NALU with Type "Supplemental enhancement information (SEI) (non-VCL)" received. code (6)
2017-03-01 17:50:50.482083 ACCleanStream2[4845:1443256] NALU with Type "Coded slice of an IDR picture (VCL)" received. code (5)

最后转换为AVCC
nalUnits长度1690

(lldb) po [nalUnits description]
<00000009 2742001e ab40501e c8000000 0428ce3c 30000000 29060523 47564adc 5c4c433f 94efc511 3cd143a8 00000300 00030002 8f5c2801 ffccccff 02004c4b 40800000 065425b8 2002ffff fe0898a0 0020cfef 78adeef3 f7abc5cf defbefbe fbefbefb d5e2ef9f d5ea7d5e f14cf890 fabcbcff af9fd5f3 fe9f0a02 81a7c400 ff5e2b7d e27cf890 f7be7c2f 4179f5a9 f15f56eb ac56b4d6 ab74b4b5 d75d3aae baebad57 5d75aa71 75c9bbe9 55134aab a26b1ca2 74d75d74 4d74e849 e9cd8b75 d75d6a6e f4a6c5d6 ebae9eba ebaeb55d 75aad53b ae95d75d 6ab55aa5 a7424e45 2baeba77 5c8ea952 5badd75d 75cce0d5 20affffd 05fd57d1 dac1eba7 75bae9eb aebaebae baeb54ae 9efa574f 5d75d74e 849ebaeb 915b4f6a 932523a9 71ab15ad d75a6ba2 46593c1f 60927d26 af55ba7a ebaebaef 55d2d77a a574f7ca ad326d6d 6d667194 2f56c4ba ef936c8a 422d6d4e 417baeb7 5d75dada ab5ad56a ba7aebae baebbc98 fb5b26d6 d5036a81 b52116b6 b6aed456 dc4b84dd 75d75bac b8fbda79 f175baeb ad562efb efbeb74a 5c6f7df7 cfdafbcf 8c9b5bd2 7971f79f 0fdad6d6 f9bb576f 5d75df5d 75d75d6e baeb57ab efbefbeb a574b4b4 b5d75d75 bac56bae ba5a5a5a 5a5a5ae6 ed5d3d75 d75cddab aebbeb3f 5d75baeb 75bac56f be5efbef bda79f1f 5d75d75d 75d75d75 d3d74b4b 4f376a5a eb2e3eb9 bb5f6f7d f7abefae baebaeb9 bb574f5d 75d75d75 9b1f7df7 d74b4b4b 4b59b1ad adad6ab3 62eb9b36 3df7abd5 e2ef9793 69ed3da7 de7c5d2d 285eaf93 befbefbe baebaebb ebaebaeb 75d6eb75 8a6b97a5 362c2f64 7d5ec956 aa55b5b5 b5956d64 dd72f5d7 377b5a7a ebaebaeb aeb362dd 6ebaebae fbefbeba ddeeb05d 2404eb47 655176b3 ab556b22 b4257d6b 4b4b4e45 2b2f7d75 d3aae9d5 75d75d75 ff97fe23 5faaf4b3 a85ec87d 360ad21d 6e5c5d75 d75d75d7 5a6b758a cdde675a a59955e9 45fff97d 0675d7d4 ea3ccf2b 2451a51e 64d4d8f1 940b54f5 d75d3aae f75d75d7 377a7892 66a6ccdb d38c2653 d75d75d7 5d75d645 2fae8999 d7a9dd3a acacf6e5 0eddad7a d7af51b8 c71f5984 8175471a 6cbb355e d46d0c14 2483014b 41fff4fe c1277bd9 234ad445 495c3028 27aebae9 c5d74aeb aebae96b ffffe1ef 76aa6715 b575cdda ba7aebae baebae9e 9d539fa7 55a625c4 9f4bffd2 1f0b9d75 ae3e3b2e 0dbe290c 0cb40965 d08ce216 1e9ebae6 ef5d75ba ebaebaeb a775a49e bae9eba7 aebaebad 575d3cce b5593a75 27292167 2133892c 3894003f fb09f7dd e2490fd0 e9118e44 c484bab0 b4ce3b46 a7aeba25 8975d74b 4f5d75d6 ed5daa4d 4bd75d3d 74f5d75d 75d75d3d 3aadb338 74cb55bc 56141425 fea66709 84cf3e9f 095abd99 a270ed08 9642425a ad09985e a2492fea 7aeba73a 85d6abbd a2aa35d7 5d75bac5 6faeba7a e9ebaeb5 59b175d7 4f4e6cfd 7262fcde aaabaaa8 2f04312a 243ef124 82b6915f c3ff823e b8b62c87 a20c4c58 406aafd5 f8fcfaf3 cc3d53fc 00a7fec1 2f5d4412 6d699989 bd124fd4 e45d75d3 d73fa9d4 0b3aa59e 25494aff ff4a053d 77e291cb d75d75de ebaeba7a e9ebaeb1 21e7cd8f 5b12eba7 99c2ca67 5339a553 b3807ba1 50447426 60b9b1d1 2e3b84cb d6b8ff41 7d7a4f8f d578c545 579068d4 bbf4a96b 6ff8e271 f32abc10 1aab6a5a 09662f6a 70a82a9c ebaeba7a eb373385 a84f3a8e e44489c9 17257aeb aebadd6a bae9eba7 aeb55a4f 21159d42 eb54f10e 3f894460 a9709969 c91b686b 24a41124 869ef131 22bcbfa7 ff0afbbf 6a07f294 91477be5 8f2e415b fbeef360 b3a1ea7a eba7aed5 cf88916b 5261d443 fa9db5d7 5d75deeb ae89ae9e baef263d a5b6bad5 3ceebd22 bbd27a47 5f576a5c 6a81b529 04eac1b4 8e145027 3f5d74f7 931e7c4b 4ae6cfda faebadd6 5c7de7c5 d75d74f5 d75d7277 baeb1957 d936b6a5 209ffac9 956d5dab 89ca41e8 8515b56a bae95091 25c7b4f3 e3ebacb8 f3e3efae baebaeb9 bbd75d75 d7593175 df2abb5b 5b5b25a7 9f1e5c7d f4b5deeb aefacb8b aeb2e3eb aebaebae baebaeba 7aebaeba dd62b376 a5b26def be5ef697 5d77df7c dda96969 efbeb9bb 5135d744 d2d2d2d7 5d75d744 d75d75df 4b44d2aa 755aaeba ebaebaeb ae96b9bb d75d75d2 d2d2d737 7a269696 96baebae 6ef4f5d7 5d72f5aa c5df7df7 bbddeeb5 5d6ab55a ae96b55a aebaebae ba5aebae bae969eb 9bbd74b4 b44d75ba db585cab d5e620bc a417df5d 77df7dee b55d75aa c5d6abae baebaeba ebaeb55d 3d74f5d7 5d75bac5 6b1566c5 ded69695 53d73f7b dd6abaeb 75d75d66 ebbefbdd 6abaebae baebaeba eba7aeba ebadd75d 135d6eba eb74aeb1 5aebaeb2 f5d75cbd 75d75d6a baebaeba ebaebaeb a26baeb9 bb60>

demo HTTPLiveStreaming以及Encoder Demo和·ACCleanStream2FFmpeg_X264_CodecKBHWDecodertestFrameExtractorHTTPLiveStreamingAVCaptureSession都是保存的h264可以用VLCMac客户端本地播放,无法RTSP播放。从码流来看,找不到开始码之后的67/68/65/41等。是大小字节序问题么?

原因已查明:

通过阅读DynamicRTSPServer.cpp可以看出h264流,只支持后缀为.264,而这些Demo保存的流文件都是.h264,只要重命名即可播放。至于为什么这里保存的流没有特殊码还需继续研究。

可行的只有两条办法:

  1. FFMPEG源码分析
  2. Live555 Server调试分析

获取正确Annex b流的方式

  1. 使用ffmpeg命令
  2. 使用VLC客户端
  3. Live555流客户端保存
  4. 使用iphone摄像头录制转换
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,839评论 6 482
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,543评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 153,116评论 0 344
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,371评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,384评论 5 374
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,111评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,416评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,053评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,558评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,007评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,117评论 1 334
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,756评论 4 324
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,324评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,315评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,539评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,578评论 2 355
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,877评论 2 345

推荐阅读更多精彩内容