RTMP Message Format
The server and the client send RTMP messages over the network to
communicate with each other.
The messages could include audio, video, data, or any other messages.
The RTMP message has two parts, a header and its payload.
RTMP Header
- Message Type:
One byte field to represent the message type.
A range of type IDs (1-6) are reserved for protocol control messages. - Length:
Three-byte field that represents the size of the payload in bytes.
It is set in big-endian format. - Timestamp:
Four-byte field that contains a timestamp of the message.
The 4 bytes are packed in the big-endian order. - Message Stream Id:
Three-byte field that identifies the stream of the message.
These bytes are set in big-endian format.
RTMP Payload
The other part of the message is the payload, which is the actual
data contained in the message.
For example, it could be some audio samples or compressed video data.
References:
rtmp_specification_1.0.pdf