Including SPS and PPS in a raw h264 track

5k views Asked by At

Should a raw h.264 video track contain at the start SPS and PPS data in order for a player (at least VLC Player) to be able to play it properly?

In this Android question, I see that in this specific context - MediaCodec decoder on Android API - it is said that the two buffers need to be provided. Is this generalized. Do I provide it as 0,0,0,1,[sps],0,0,0,1,[pps]?

[EDIT]

I've added SPS and PPS as is, and now VLC Player wants to play the video. It seems to decode the proper amount of frames at the good framerate, though the frames are pink and green noise, with movements that seem to follow original movie movements. I feel like there are missing informations regarding the format of my video track data. When I demux an MP4 with FFmpeg, the provided sps at the beginning of the raw h.264 stream is richer than mine.

FFMPEG h.264 raw video track stream:

SPS 00 00 00 01 67 42 c0 0d 9a 74 03 c0 11 3f 2e 02 20 00 00 03 00 20 00 00 06 51 e2 85 54

PPS 00 00 00 01 68 ce 3c 80

The rest... 00 00 00 01 65 etc....

1

There are 1 answers

0
Sirdavos On

which library are you using to get stream ? for example if you use live555 to get stream you need to put sps and pps information before frames because ffmpeg wants these information for decoding.

00 00 00 01 for h264 format

00 00 00 01 sps 00 00 00 01 pps 00 00 00 01 data frame