RTMP Messages Decoded

An RTMP message is a series of AMF objects, used to transfer data. All messages start with the standard RTMP header, which for results is always the 12 byte header version. The AMF objects used are primarily properties of an object, so they all have a name, followed by a value.

Rather than using text bases tables, like the rest of this page, I used OpenOffice to make an annotated color coded exaplanation of decoding several commonly seen RTMP packets. The easy to print version is here as a PDF, and the original original ODT file, incase somebody makes corrections or adds more packets.

NC Connect Success Message

03 00 00 00 00 00 81 14 00 00 00 00(rtmp header)
02 00 07 5f 02 65 73 75 6c 74"_result"
00 3f f0 00 00 00 00 00 00 05(a double)
03(start object)
00 0b 61 70 70 6c 69 63 61 74 69 6f 6e"application"
00 05 6c 65 76 65 6c"level"
02 00 06 73 74 61 74 75 73"status"
00 0b 64 65 73 63 72 69 70 74 69 6f 6e"description"
02 00 15 43 6f 6e 6e 65 63 74 69 6f 6e 20 73 75 63 63 65 65 64 65 64 2e"Connection succeeded"
00 04 63 6f 64 65"code"
02 00 1d 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 53 75 63 63 65 73 73"Connection.Connect.Sucess"
00 00 09(end of object)

 ??? Message

03 00 00 00 00 00 bf 14 00 00 00 00(rtmp header)
02 00 07 5f 72 65 73 75 6c 74"_result"
00 3f f0 00 00 00 00 00 00(a double)
03(start object)
00 06 66 6d 73 56 65 72"fmsVer"
02 00 0e 46 4d 53 2f 33 2c 30 2c 30 2c 31 31 35 37"FMS/3,0,0,1157"
00 0c 63 61 70 61 62 69 6c 69 74 69 65 73"capabilities"
00 40 3f 00 00 00 00 00 00(a double)
00 00 09(end of object)
03(start object)
00 05 6c 65 76 65 6c"level"
02 00 06 73 74 61 74 75 73"status"
00 04 63 6f 64 65"code"
02 00 1d 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 53 75 63 63 65 73 73"NetConnection.Connect.Success"
00 0b 64 65 73 63 72 69 70 74 69 6f 6e"description"
02 00 15 43 6f 6e 6e 65 63 74 69 6f 6e 20 73 75 63 63 65 65 64 65 64 2e"Connection succeeded"
00 0e 6f 62 6a 65 63 74 45 6e 63 6f 64 69 6e 67"objectEncoding"
00 00 00 00 00 00 00 00 00(a double)
00 00 09(end of object)

The result

03 00 00 00 00 00 1d 14 00 00 00 00(rtmp header)
02 00 07 5f 72 65 73 75 6c 74"_result"
00 40 00 00 00 00 00 00 00CallID (double)
05(a null)
00 3f f0 00 00 00 00 00 001.: the created stream ID (a double)

Publish Message

08/00 00 be/00 00 29/14/01 00 00 00(rtmp header) channel 8, timestamp 0xbe ms, 0x29(41) bytes, Packet type 0x14 (invoke), StreamID 1. (notice: Little Endian !)
02 00 07 70 75 62 6c 69 73 68"publish"
00 00 00 00 00 00 00 00 00CallID (double)
05(a null)
02 00 0b 6c 69 76 65 73 74 72 65 61 6d 32"livestream2"
02 00 04 6c 69 76 65"live"


Command

42/00 00 00/00 00 0a/04Header Header: 0x42: 01_00_0011, 8 bytes header, channel 2, streamID of the previous channel 2 message, timestamp:0, size: 0x0a, type 0x4:command
00 03/00 00 00 01/00 00 00 000x03: , ID: 0x1, 0x0


Command

02/00 00 00/00 00 06/04/00 00 00 00 
00 00/00 00 00 01  


Invoke onStatus

04/00 00 00/00 00 8b/14/01 00 00 00 
02 00 08 6f 6e 53 74 61 74 75 73"onStatus"
00 00 00 00 00 00 00 00 00 05(a double)
03(start object)
00 05 6c 65 76 65 6c"level"
02 00 06 73 74 61 74 75 73"status"
00 04 63 6f 64 65"code"
02 00 17 4e 65 74 53 74 72 65 61 6d 2e 50 75 62 6c 69 73 68 2e 53 74 61 72 74

"NetStream.Publish.Start"

00 0b 64 65 73 63 72 69 70 74 69 6f 6e"description"
02 00 1d 6c 69 76 65 73 74 72 65 61 6d 32 20 69 73 20 6e 6f 77 20 70 75 62 6c 69 73 68 65 64 2e 00 08 63 6c 69 65 6e 74 69 64"livestream2 is now published"
02 00 08 c4 41 44 41 41 34 4d 46 48"clientid"
02 00 08 c4 41 44 41 41 34 4d 46 48"ADAA4MFH"
00 00 09(end of object)

Error Message

03 00 00 00 00 00 9e 14 00 00 00 00(rtmp header)
02 00 06 5f 65 72 72 6f 72"error"
00 3f f0 00 00 00 00 00 00 05(a double)
03(start object)
00 05 6c 65 76 65 6c"level"
02 00 05 65 72 72 6f 72"error"
00 04 63 6f 64 65"code"
02 00 1e 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 52 65 6a 65 63 74 65 64"NetConnection.Connect.Rejected"
00 0b 64 65 73 63 72 69 70 74 69 6f 6e"description"
02 00 41 5b 20 53 65 72 76 65 72 2e 52 65 6a 65 63 74 20 5d 20 3a 20 56 69 72 74 75 61 6c 20 68 6f 73 74 20 5f 64 65 66 61 c3 75 6c 74 56 48 6f 73 74 5f 20 69 73 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 2e"A[ Server.Reject ] : Virtual host _default VHost_ is not available"
00 00 09(end of object)

Close Message

03 00 00 00 00 00 12 14 00 00 00 00(rtmp header)
02 00 05 63 6c 6f 73 65"close"
00 00 00 00 00 00 00 00 00 05(a double)

BW Done Message

03 00 00 00 00 00 15 14 00 00 00 00(rtmp header)
02 00 08 6f 6e 42 57 44 6f 6e 65"onBWDone"
00 00 00 00 00 00 00 00 00 05(a double)


Extended time

06Channel 6, 12 bytes header (plus 4 bytes for extended timestamp)
ff ff ffTimestamp: 0xffffff: the extended timestamp
00 82 90Payload size: 0x8290 bytes
09Payload type: Video
01 00 00 00Little endian stream ID: 0x1
02 b0 1f bdExtended timestamp: 0x02b01fbd

Compressed header:

c6Channel 6, 1 bytes header (plus 4 bytes for extended timestamp)
02 b0 1f bdExtended timestamp: 0x02b01fbd

转自: http://wiki.gnashdev.org/RTMP_Messages_Decoded

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值