1

I have web-service which provides me custom format of container which contains H.264 NAL units. I want to play them via MediaElement in silverlight using custom MediaStreamSource.

According this article I need to set private codec data. Web service provides me configCodec but in base64 format (looks like "AUIAHv/hABhnQsAe2gMg7+IhAAADAAEAAAMAMo8WLqABAARozgvI")

So, in other platforms (iOS, Android) all I need is set to extra-data property of codec.

codec->extra-data = info;

But in Windows Phone I should provide this info like 00000001 [SPS] 00000001 [PPS]. So, could someone tell me how I can parse provided private data from web-service to get SPS and PPS values from it?

Roman Golenok
  • 1,427
  • 9
  • 26

1 Answers1

2

Your data decoded into hex is:

0x01 0x42 0x00 0x1E 0xFF 
0xE1 
0x00 0x18 (SPS length in bytes)
0x67 0x42 0xC0 0x1E 0xDA 0x03 0x20 0xEF (SPS...)
0xE2 0x21 0x00 0x00 0x03 0x00 0x01 0x00 
0x00 0x03 0x00 0x32 0x8F 0x16 0x2E 0xA0 (...SPS)
0x01 
0x00 0x04 (PPS length in bytes)
0x68 0xCE 0x0B 0xC8 (PPS)

I don't know what this structure exactly is and where it is rfom, however SPS and PPS are definitely on it.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Could explain it? Or maybe provide me a link for information about this parsing? – Roman Golenok Aug 22 '12 at 09:54
  • 1
    SPS and PPS are described in MPEG-4 Part 10 specification. `0x67` is NAL unit type 7 (SPS). Type 8 is PPS. Length bytes reasonably match. Anything else? Exact data structure depend on where you took it from, you say "Web service provides me...". – Roman R. Aug 22 '12 at 10:04