streamingh.264rtmppts

how to send PTS for h264 over RTMP


I've done lots of searching but can't get quite enough info on how this really all come together.

So I understand that H264 frames contain some SPS and PPS info on the frames that you can extract frame rate from. But the PTS is actually coded in the PES? So how is PES transported in RTMP?

I'm using librtmp and a RTMPServer to push h264 frames. Does the server simply send the same packets to the clients that I send using librtmp? And RTMP has its own timestamp and framerate it seems in the packets it sends. So does RTMP client not need to extract framerate from h264 frames, etc and just rely on the RTMP packet data?

It'd be cool if anyone can explain how this all works together. And I am eventually trying to send useful timing info that can be parsed on the client side for absolute times.


Solution

  • Rtmp uses FLV to send the data. FLV has a 32 bit (technically it’s 24+8) field to set the DTS. It then has a separate fields to set the CTS, CTS = PTS - DTS.