RTMP Messages Decoded

本文详细解析了RTMP协议中各种消息类型的格式与内容,包括连接成功消息、未知消息、结果消息、发布消息等,并展示了如何解读这些消息的具体实例。

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

Delphi 12.3 作为一款面向 Windows 平台的集成开发环境,由 Embarcadero Technologies 负责其持续演进。该环境以 Object Pascal 语言为核心,并依托 Visual Component Library(VCL)框架,广泛应用于各类桌面软件、数据库系统及企业级解决方案的开发。在此生态中,Excel4Delphi 作为一个重要的社区开源项目,致力于搭建 Delphi 与 Microsoft Excel 之间的高效桥梁,使开发者能够在自研程序中直接调用 Excel 的文档处理、工作表管理、单元格操作及宏执行等功能。 该项目以库文件与组件包的形式提供,开发者将其集成至 Delphi 工程后,即可通过封装良好的接口实现对 Excel 的编程控制。具体功能涵盖创建与编辑工作簿、格式化单元格、批量导入导出数据,乃至执行内置公式与宏指令等高级操作。这一机制显著降低了在财务分析、报表自动生成、数据整理等场景中实现 Excel 功能集成的技术门槛,使开发者无需深入掌握 COM 编程或 Excel 底层 API 即可完成复杂任务。 使用 Excel4Delphi 需具备基础的 Delphi 编程知识,并对 Excel 对象模型有一定理解。实践中需注意不同 Excel 版本间的兼容性,并严格遵循项目文档进行环境配置与依赖部署。此外,操作过程中应遵循文件访问的最佳实践,例如确保目标文件未被独占锁定,并实施完整的异常处理机制,以防数据损毁或程序意外中断。 该项目的持续维护依赖于 Delphi 开发者社区的集体贡献,通过定期更新以适配新版开发环境与 Office 套件,并修复已发现的问题。对于需要深度融合 Excel 功能的 Delphi 应用而言,Excel4Delphi 提供了经过充分测试的可靠代码基础,使开发团队能更专注于业务逻辑与用户体验的优化,从而提升整体开发效率与软件质量。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值