Invalid Codec Private Data Exception when viewing KVS produced by a custom Android Producer

0

Hi! We've implemented custom Android Producer, using examples as a reference point from:

The implementation should work correctly as in the AWS console we can see that data is being streamed: Enter image description here

We're streaming H.265 encoded video stream and have found out the following CPD (Codec Private Data) in the stream:

00 00 00 01 40 01 0c 01 ff ff 01 40 00 00 03 00 
80 00 00 03 00 00 03 00 78 ac 0c 00 00 0f a0 00 
01 d4 c2 00 fa 28 00 00 00 01 42 01 01 01 40 00 
00 03 00 80 00 00 03 00 00 03 00 78 a0 03 c0 80 
10 e7 fa 2e ec 91 77 a2 5d 58 10 00 00 3e 80 00 
07 53 0c 40 00 00 00 01 44 01 c1 ad f0 13 64

It consists of Sequence Parameter Set (SPS), Picture Parameter Set (PPS) and Video Parameter Set (VPS) frames, each starting with start bytes 00 00 00 01. As specified in the reference manual for Stream Structures we've used this data to specify the final byte[] codecPrivateData when creating a new StreamInfo object, which is created in our implementation of custom MediaSource, overridden in method getStreamInfo. Based on above data in the stream we've passed it in the following way:

new byte[]{0x00, 0x00, 0x00, 0x01, 0x40, 0x01, 0x0c, 0x01, (byte) 0xff, (byte) 0xff, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, (byte) 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x78, (byte) 0xac, 0x0c, 0x00, 0x00, 0x0f, (byte) 0xa0, 0x00, 0x01, (byte) 0xd4, (byte) 0xc2, 0x00, (byte) 0xfa, 0x28, 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, (byte) 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x78, (byte) 0xa0, 0x03, (byte) 0xc0, (byte) 0x80, 0x10, (byte) 0xe7, (byte) 0xfa, 0x2e, (byte) 0xec, (byte) 0x91, 0x77, (byte) 0xa2, 0x5d, 0x58, 0x10, 0x00, 0x00, 0x3e, (byte) 0x80, 0x00, 0x07, 0x53, 0x0c, 0x40, 0x00, 0x00, 0x00, 0x01, 0x44, 0x01, (byte) 0xc1, (byte) 0xad, (byte) 0xf0, 0x13, 0x64 },

Also we've specified flag NAL_ADAPTATION_ANNEXB_CPD_AND_FRAME_NALS as last parameter when creating StreamInfo. According to the following document about NAL Adaptation Flags our stream is in Annex-B delimited format for NALUs, which means we need to use that flag.

But regardless of all that, we're still seeing the following error in KVS media viewer:

"message": "Could not parse CPD in HEVC (H.265) format.",
"code": "InvalidCodecPrivateDataException",

I've prepared a 10s long video stream in H.265 accessible here if it helps debug this issue and to check that CPD is indeed correct.

jeryini
asked a year ago81 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions