




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
rtmpdump 的 librtmp 时间戳有问题 服 务器会断开连接 分类 ffmpeg c linux open source 2013 10 28 21 49 700人阅读 评论 7 收藏 举报 header 0 x44 0 xff 0 xff 0 xff 0 x00 0 x01 0 x19 0 x08 extended timestamp 0 x7f 0 xff 0 xf8 0 x00 body 0 xaf 0 x01 0 x01 0 x40 0 x22 0 x80 0 xa3 0 x7f 0 xf8 0 x85 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d header 0 xc4 extended timestamp error here body 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 0 x2d 对于0 xC 这种后续的 chunk 包的 extended timestamp 该不该发 rtmp 协议中说是不发 但是 FMLE 是发的 推流超过4 5小时就需要用 extended timestamp 了 rtmpdump 里面的 librtmp 不会发这个包 ffmpeg 里面用 enable librtmp 就会使 用这个 rtmp 的库 而且是在开始就会发这个包 6 1 3 Extended Timestamp plain view plaincopyprint This field is transmitted only when the normal time stamp in the chunk message header is set to 0 x00ffffff If normal time stamp is set to any value less than 0 x00ffffff this field MUST NOT be present This field MUST NOT be present if the timestamp field is not present Type 3 chunks MUST NOT have this field This field is transmitted only when the normal time stamp in the chunk message header is set to 0 x00ffffff If normal time stamp is set to any value less than 0 x00ffffff this field MUST NOT be present This field MUST NOT be present if the timestamp field is not present Type 3 chunks MUST NOT have this field 有可能是 adobe 变更了这个协议 也就是说 FMLE 给 FMS FMS 给 flash player 都 是带这个时间戳的 收包时 服务器端则需要检测下 若接下来的4字节不是 extended timestamp 那么就 忽略就好了 发包时 只能采取配置 要么发 要么不发 默认发就好了 看 nginx rtmp 代码 cpp view plaincopyprint ngx rtmp recv ngx event t rev for parse headers if b pos b start chunk basic header fmt p 6 csid p if fmt little endian 4b pp u char timestamp ext timestamp 0 x00ffffff if fmt little endian 4b type pp u char h type uint8 t p if fmt 0 stream little endian 4b little endian 4b pp u char extended header if ext pp u char timestamp pp 3 p pp 2 p pp 1 p pp 0 p ngx rtmp recv ngx event t rev for parse headers if b pos b start chunk basic header fmt p 6 csid p if fmt little endian 4b pp u char timestamp ext timestamp 0 x00ffffff if fmt little endian 4b type pp u char h type uint8 t p if fmt 0 stream little endian 4b little endian 4b pp u char extended header if ext pp u char timestamp pp 3 p pp 2 p pp 1 p pp 0 p 可见 不管是什么 chunk 只要有 extended timestamp nginx rtmp 都会读这个 所 以 nginx rtmp 对接 FMLE 是没有问题的 对接 librtmp 有问题 更好的做法是判断下读出来的 extended timestamp 是否是和之前的一样 如果不是一样 说明没有发 就忽略 nginx rtmp 发包的逻辑 cpp view plaincopyprint ngx rtmp prepare message create fmt3 header for successive fragments thsize p out buf pos ngx memcpy th out buf pos thsize th 0 0 xc0 message header if fmt play time fix ngx memcpy thsize 4 ngx rtmp prepare message create fmt3 header for successive fragments thsize p out buf pos ngx memcpy th out buf pos thsize th 0 0 xc0 message header if fmt play time fix ngx memcpy thsize 4 nginx rtmp 还特意说明了 flash 客户端就是和 rtmp 规范不一样 out buf pos 就是指向包的第一个 chunk 若有 extended timestamp 那么肯定会 在第一个包加上 extended timestamp 后面还有个 th 和 thsize 就是给后续的 type 3 的 chunk 包的 会加上这4字节的 extended timestamp cpp view plaincopyprint This CONTRADICTS the standard but that s the way flash client wants data to be encoded ffmpeg complains if cscf play time fix ngx memcpy thsize 4 append headers to successive fragments for out out next out out out next out buf pos thsize ngx memcpy out buf pos th thsize This CONTRADICTS the standard but that s the way flash client wants data to be encoded ffmpeg complains if cscf play time fix ngx memcpy thsize 4 append headers to successive fragments for out out next out out out next out buf pos thsize ngx memcpy out buf pos th thsize 所以 nginx rtmp 收发包都是需要这个 extended timestamp 对于 chunk type 为3的 包 另外 把 chunksize 设置大一点 最大是65536 避免发 type 3的 chunk 包 也是一个 很好的方法 不过视频的 I 帧一般较大 超过64KB 也有可能 The maximum chunk size can be 65536 bytes and minimum 128 bytes 按照这种规则 即 type 3的 chunk 也发 extended tim
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年网络编辑师考试网络编辑人工智能与智能数据清洗技术试卷
- 文件存档及资料管理系统设计规范
- 外包加工制造协议规定内容说明
- 2025年汽车维修工(汽车维修行业人才培养)职业技能鉴定全真试题卷
- 2025年无损检测员(初级)职业技能鉴定真题模拟解析技巧
- 期中试卷数学试卷
- 《树和喜鹊》课件 统编版语文一年级下册
- 宁夏的中考数学试卷
- 去年江西省会考数学试卷
- 七宝实验小学数学试卷
- 2024年司法考试刑法真题及答案
- 《隔离技术规范》课件
- 《云南省学校安全条例(修订草案)》知识培训
- 面向工业智能化时代的新一代工业控制体系架构白皮书
- 四年级下册数学方程题100道及答案
- 浙江省二轻集团招聘笔试题库2024
- 护士健康宣教指导手册系列老年病房
- 贵州省遵义市红花岗区2024届小升初模拟数学测试卷含解析
- 盗墓笔记解析版
- 课件:校罗盘的程序课件讲解
- 车库业主与租赁者安装充电桩协议书
评论
0/150
提交评论