On Sat, Feb 6, 2010 at 11:34 AM, Tom Pepper <<a href="mailto:tom@silocorp.com">tom@silocorp.com</a>> wrote:<br>> Jeremy:<br>><br>> Thanks for the quick response. I've had difficulty locating a good source of information on what the parameter sets should look like, so that's probably the issue.<br>
><br>> MainConcept provides them via h264OutVideoGetParSets(). Here's the code I use to retrieve them and parse:<br>><br>> // get AVC Parameter Sets<br>> char * parset = (char *) malloc(1024);<br>
> int length;<br>><br>> if(h264OutVideoGetParSets(v_encoder, &v_settings, (uint8_t *) parset, &length)) {<br>> fprintf(stderr,"h264OutVideoGetParSets() failed!");<br>
> exit(-1);<br>> }<br>> fprintf(stderr, "h264OutVideoGetParSets: %i\n", length);<br>> hexdump(parset, length);<br>><br>> char *b64parset = base64Encode(parset + 4, length - 4); // skip sync<br>
> fprintf(stderr, "b64parset: %s, %zu\n", b64parset, strlen(b64parset));<br>><br>> unsigned int numrecords = 0;<br>> SPropRecord* poo = parseSPropParameterSets(b64parset, numrecords);<br>
><br>> for (unsigned i = 0; i < numrecords; ++i) {<br>> fprintf(stderr, "decoded [%i] = %s\n", i, poo[i].sPropBytes);<br>> }<br><br>The problem is that you're base64 encoding both SPS and PPS info in one big block--the two are supposed to be individually base64 encoded, and then delimited with a comma. In other words, the final entry should look like:<br>
<br>sprop-parameter-sets=spsInBase64,ppsInBase64<br><br>On the client side, it splits this string on the comma character and then decodes each side separately.<br><br>It does look like h264OutVideoGetParSets() delimits the output with NAL start codes (0x00000001), so splitting the parameter sets apart shouldn't be too difficult. If you want to identify SPS and PPS separately, that's a bit more work to parse the NAL unit headers (see H264 specification if you need to do this--it's a few lines of bit-twiddling, more or less).<br>