I need the slice-height
and stride
information in order to convert the YUV 4:2:0 Planar data to RGB.
Is it inside the SPS/PPS? How do I calculate it?
SPS = [0, 0, 0, 1, 103, 66, -32, 13, -90, -63, 65, -97, -97, 1, 66, 2, 2, 3, -32, 0, 0, 125, 32, 0, 29, 76, 18, -128]
PPS = [0, 0, 0, 1, 104, -50, 49, 18, 0, 0, 1, 6, 0, 1, -64, 6, 1, -124, 1, 1, 4, 4, 10, -75, 0, 49, 68, 84, 71, 49, 65, -8, -1, 83, 4, 64, 0, 2, 7, 93, 18, 0, 0, -94, 58, 0, 0, -94, 58, 0, 2, -102, 55, 0, 0, -100, -128, -128, 21, -128]
The Android MediaCodec
shows this information after a MediaCodec.INFO_OUTPUT_FORMAT_CHANGED
:
{image-data=java.nio.ByteArrayBuffer[position=0,limit=80,capacity=80], mime=video/raw, crop-top=0, crop-right=319, slice-height=192, color-format=21, height=192, width=320, what=1869968451, crop-bottom=179, crop-left=0, stride=384}
How do I get this information directly from a H.264 stream?
This information is not contained within the coded stream. The concept of stride does not exist in a coded frame. It is purely a decoded image concept, and can be any value equal to or larger than the width.