Reputation: 2973
It might be silly question but what should be placed in MKV Codec private section for H264? I have an app that captures video streams from users and sends them over RTP. I'm creating mkv out of them.
My undestanding is that codec-specific private data block for H264 should contain SPS and PPS informations.
So am i right that to generate one, i should look for first SPS and PPS packets in stream and use them in header block?
Upvotes: 1
Views: 1305
Reputation: 108796
For what it's worth, Chromium-based browsers can emit the MIME type 'video/webm; codecs="avc1.42E01E"'
directly using MediaStream functionality. That bitstream has H.264's SPS and PPS NALUs prepended to the other NALUs for each frame. The SPS and PPS get repeated for every frame, redundantly. That's not horrible, because they're not large.
Frame data shows up in Matroska SimpleBlock chunks as a series of NALUs concatenated together in byte stream format separated by start codes.
You can treat your SPS and PPS objects as if they were ordinary H.264 stream data (NALUs) in Matroska. The MPEG4 boxing format stashes them in a special place, in an avcC
Decoder Configuration Atom. Not so Matroska / webm.
Upvotes: 1
Reputation: 8244
There is no guarantee that the PPS/SPS are transmitted inside the RTP stream. I would extract PPS/SPS during the RTSP setup process.
Upvotes: 3