<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 1, 2014, at 9:58 AM, Vikram Singh <<a href="mailto:vikram@vizexperts.com">vikram@vizexperts.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Hi ross,<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I am not able to get SPS and PPS units from the encoder.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I am using CUDA Video Encode library which has a function NVGetSPSPPS().</span></div></div></div></blockquote>[...]</div><div><div><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1;"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1;"><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: red;"> </span></pre><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Sorry I am not getting the detailed documentation for the function NVGetSPSPPS(). Please help me.</span></div></div></div></blockquote></div></div></blockquote><div><br></div>"NVGetSPSPPS()" is not a function in our code, so I don't know why you're asking here. Why don't you ask whoever provided you the "CUDA Video Encode library"?</div><div><br></div><div><br></div><div>However...</div><div><br><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1;"><div><span style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 11pt;">NVGetSPSPPS() returns a buffer to SPS and PPS.</span></div></div></div></blockquote></div><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">The problem is that I don’t have the formatting for this buffer so that I could separate SPS and PPS units from each other.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">In my case this buffer is<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> 00 24<span class="Apple-converted-space"> </span></span><b><span style="font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">67</span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: red;">4d 40 1e f6 04 00 83 7f e0 00 80 00 62 00 00 07 d2 00 01 d4 c1 c0 00 00 27 a1 20 00 02 62 5a 17 79 70 50 00 04<span class="Apple-converted-space"> </span></span><b><span style="font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">68</span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: red;">ee 3c 80</span></div></div></div></blockquote><div><br></div>It seems quite clear that the encoding is:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Sequence of:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>2-byte 'length' (in big-endian order)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>'length' bytes, containing the NAL unit (without a preceding 'start code')</div><div><br></div><div><br></div><div><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> </span><span style="font-family: Calibri, sans-serif; font-size: 11pt;">According to my assumption </span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> </span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> 00 00 00 01 </span><b><span style="font-size: 12pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">67 </span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: red;">4d 40 1e f6 04 00 83 7f e0 00 80 00 62 00 00 07 d2 00 01 d4 c1 c0 00 00 27 a1 20 00 02 62 5a 17 79 70 50 00 04 ==> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif;">sps<o:p></o:p></span></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">And 00 00 00 01 </span><b><span style="font-size: 12pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">68</span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: red;">ee 3c 80 ==> pps</span></pre></div></div></blockquote><div><br></div>Not quite, because it seems clear that the "00 24" is a length field (i.e., 0x0024 == 36 decimal). Therefore SPS is</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>67 4d 40 1e f6 04 00 83 7f e0 00 80 00 62 00 00 07 d2 00 01 d4 c1 c0 00 00 27 a1 20 00 02 62 5a 17 79 70 50</div><div>then the next two bytes - 00 04 - are also a length field (therefore, *not* part of the NAL unti), so PPS is</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>68 ee 3c 80</div><div><br></div><div>You should therefore pass these two NAL units - without start codes - as parameters to</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>H264VideoRTPSink::createNew()</div><div>This will be the second form of "H264VideoRTPSink::createNew()" - i.e., the form that has the signature</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static H264VideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat,<br><span class="Apple-tab-span" style="white-space:pre"> </span>u_int8_t const* sps, unsigned spsSize,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>u_int8_t const* pps, unsigned ppsSize,<br><span class="Apple-tab-span" style="white-space:pre"> </span>unsigned profile_level_id);</div><div><br></div><div>Note that you also need to pass a "profile_level_id" parameter. This is actually a flaw in the code, because you can generate this parameter from the 2nd through 4th bytes of the SPS NAL unit. (I.e., this parameter shouldn't be needed.) So, in your case, the "profile_level_id" parameter would be</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>0x4d401e</div><br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>