如果rtmp推流地址:
rtmp://服务器地址:rtmp端口/路径/名称
对应的websocket地址:
ws://服务器地址:websocket端口/路径/名称.flv
举例:
live作为路径,s作为流名称,rtmp端口是1932那么rtmp地址如下:
rtmp://127.0.0.1:1932/live/s
对应的websocket的地址:
ws://127.0.0.1:8000/live/s.flv
因为这里8000是websocket的端口
我用的是wireshark捕获的rtmp,
rtmp推流流程:
这里面wireshark判断当前协议是否是rtmp的标志是这个包里是否有Real Timing Message Control
Frame的开头是个网络类型(4byte),通过工具捕获到他的值是2,也就是family:ip,正常的TCP/IP协议
Internet Protocal Version:
这里面包含了帧长度,(帧长度+4byte=包的长度),还包含了,seq,ack,Win数据长度
通过跟踪发现: client向服务器推流到server,包括audio Data,和video Data:
format为1的时候,format为3的时候
客户端(client) Server(server)
msg:client->server
client :seq 17 Server:seq:1
server->client: 第一次握手
client->server:再握手
Server->client:第三次握手
client->Server:rtmp所谓real timing message control来握手
c->s: Handshake C0+C1
s->c:rely(指的是seq,ack的正常服务器应答)
c->s: Handshake S0+S1+S2
s->c:rely
c->s:Handshake:C2
s->c:rely
c->s:set chunk size 4096
s->c:rely
c->s:connect('live')
s->c:rely
c->s:Window Acknowledgement Size:5百万
s->c:rely
c->s:set peer bandwidth:5百万
s->c:rely
c->c:set chunk size 60000
s->c:rely
c->s:rely (只不过是 seq,ack交互,没有实体)
s->c:rely
c->s:releaseStream('1')
s->c:rely
c->s:FCPublish('1')
s->c:rely
c->s:createStream('1')
s->c:rely
c->s:_result()
s->c:rely
c->s:publish('1')
s->c:rely
c->s:onStatus('NetStream.Publish.Start')
s->c:rely
c->s:setDataFrame()
video:avc1 audio:mp4a
s->c:rely
c->s:Audio Data
s->c:rely
c->s:Video Data
VideoData:用的是h264的keyframe
Audio Data:用的是aac的keyframe
标签:seq,流程,Server,live,client,relyc,rtmp,解析 From: https://www.cnblogs.com/yang131/p/16667665.html