RTMP is almost done

3 Aug 2012

It is very difficult to build an RTMP server.

The most difficult part is that the RTMP document is very misleading.

For example, Message is not used at all.

CommandMessage doesn't follow the format of Message.

ProtocolMessage also doesn't follow the format of Message.

Why the fuck does Message exist at all?

It also doesn't specify what format of a video message is being sent. Today, I've figured that out that it is VIDEODATA in FLV file with the h.263 coding.

The only clue is the first 11 bytes, which are the same on every message. They are 0x12 0x00 0x00 0x84 0x00 0x81 0x2c 0x00 0xc8 0x00 0x9f.

At first, I thought it was the tag header of SCRIPTDATA because it starts with 0x12. But then I've found that VIDEODATA can start with 0x12 as well: 0001 means the key frame and 0002 means Sorensen H.263.

It's really amazing that I look at the document and feel that it might be VIDEODATA.

It's like Universe wants me to figure out this shit. Thanks God, I almost gave up.

Right now I can receive video data stream and compose an FLV file.

Tomorrow I think I'll work on the bit rate and get the Flash client to send the audio data as well.