Closed eduardotang closed 1 year ago
not supported yet. if you can do this, welcome a PR
i have tried my best, but it didnt seem to work........... snippet from NewRTMPClient in client.go, basically just create the tls connection and change NetConnection to take net.Conn instead of *net.TCPConn
the log show connect success and publish start, so i assume the connection is ok??
isRtmps := u.Scheme == "rtmps"
if strings.Count(u.Host, ":") == 0 {
if isRtmps {
u.Host += ":443"
} else {
u.Host += ":1935"
}
}
var conn net.Conn
if isRtmps {
conn, err = tls.Dial("tcp", u.Host, &tls.Config{})
} else {
conn, err = net.Dial("tcp", u.Host)
}
if err != nil {
RTMPPlugin.Error("dial tcp", zap.String("host", u.Host), zap.Error(err))
return nil, err
}
client = &NetConnection{
Conn: conn,
Reader: bufio.NewReader(conn),
writeChunkSize: conf.ChunkSize,
readChunkSize: RTMP_DEFAULT_CHUNK_SIZE,
rtmpHeader: make(map[uint32]*ChunkHeader),
incompleteRtmpBody: make(map[uint32]*util.Buffer),
bandwidth: RTMP_MAX_CHUNK_SIZE << 3,
tmpBuf: make([]byte, 4),
}
13:07:49 INFO connect {"plugin": "RTMP", "appName": "live", "objectEncoding": 0} 13:07:49 INFO decode command amf0 {"plugin": "RTMP", "cmd": "FCPublish"} 13:07:49 INFO createStream: {"plugin": "RTMP", "streamId": 1} 13:07:49 INFO publish {"plugin": "RTMP", "path": "live/test"} 13:07:49 INFO created {"stream": "live/test"} 13:07:49 INFO ⌛->🟢 {"stream": "live/test", "action": "publish"} 13:07:49 INFO push {"plugin": "RTMP", "path": "live/test", "url": "rtmps://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} 13:07:49 INFO subscribe {"plugin": "HLS", "path": "live/test"} 13:07:49 INFO start push {"plugin": "RTMP", "path": "live/test", "url": "rtmps://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} 13:07:49 INFO suber +1 {"stream": "live/test", "type": "HLSWriter", "remains": 1} 13:07:49 INFO subscribe {"plugin": "RTMP", "path": "live/test"} 13:07:49 INFO suber +1 {"stream": "live/test", "type": "RTMPPusher", "remains": 2} 13:07:51 INFO track +1 {"stream": "live/test", "name": "h264"} 13:07:51 INFO track+1 {"stream": "live/test", "type": "HLSWriter", "name": "h264"} 13:07:51 INFO track+1 {"stream": "live/test", "type": "RTMPPusher", "name": "h264"} 13:07:59 INFO playblock {"stream": "live/test", "type": "HLSWriter"} 13:07:59 INFO firstIFrame {"stream": "live/test", "type": "HLSWriter", "seq": 0} 13:07:59 INFO _result : {"plugin": "RTMP", "code": "NetConnection.Connect.Success"} 13:07:59 INFO connect {"plugin": "RTMP", "remoteURL": "rtmps://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} 13:07:59 INFO _result : {"plugin": "RTMP", "code": "NetStream.Publish.Start"} 13:07:59 INFO playblock {"stream": "live/test", "type": "RTMPPusher"} 13:07:59 INFO firstIFrame {"stream": "live/test", "type": "RTMPPusher", "seq": 0}
it seems you what to relay rtmp to rtmps? and handshake was succeed…… I can't find out what is wrong. first of all, make sure push rtmp is ok.
it seems you what to relay rtmp to rtmps? and handshake was succeed…… I can't find out what is wrong. first of all, make sure push rtmp is ok.
yes, and the push rtmp works, have successfully viewed it in /preview/live/test using http-flv
and i have just tested with youtube rtmps, it is not working either and the log show Publish.Start as well, so is it rtmp to rtmps relay problem??
14:18:19 INFO _result : {"plugin": "RTMP", "code": "NetConnection.Connect.Success"} 14:18:19 INFO connect {"plugin": "RTMP", "remoteURL": "rtmps://a.rtmps.youtube.com/live2/xxxxxxxxxxxxxxxxxx"} 14:18:19 INFO decode command amf0 {"plugin": "RTMP", "cmd": "onBWDone"} 14:18:20 INFO _result : {"plugin": "RTMP", "code": "NetStream.Publish.Start"} 14:18:20 INFO playblock {"stream": "live/test2", "type": "RTMPPusher"} 14:18:20 INFO firstIFrame {"stream": "live/test2", "type": "RTMPPusher", "seq": 0}
you what to push rtmps to youtube?
you what to push rtmps to youtube?
no , i just want to make sure its not the problem of the rtmps server
so how do you know it's not working
when you try to do live in youtube , it has a preview of the stream but i dont see it.............
maybe it has nothing to do with tls. or there are bugs in pushing rtmp to other server. I need check it
i am using ffmpeg to pull rtsp and push to rtmp
ffmpeg -i rtsp://.................... -c:v libx264 -an -f flv rtmp://xxxxxxxxxxxxxxxxxxxx/live/test
receving rtmp is not the problem
just FYI, as i can see in /preview , i guess receiving should be fine
i am using ffmpeg to pull rtsp and push to rtmp
ffmpeg -i rtsp://.................... -c:v libx264 -an -f flv rtmp://xxxxxxxxxxxxxxxxxxxx/live/test
maybe something wrong with pushing rtmp to other servers
ok, more findings, but dont know whether it is related
i use another client which i am sure it works with rtmps but i got below exception if i change it to push to monibuca rtmp
panic: interface conversion: rtmp.AMFValue is *struct {}, not float64
goroutine 43 [running]:
m7s.live/plugin/rtmp/v4.(*RTMPConfig).ServeTCP(0x1c1fdc0, 0xc000014028)
/go/monibuca/workspace/plugin-rtmp/server.go:75 +0x1c1f
created by m7s.live/engine/v4/config.(*TCP).listen
/go/monibuca/workspace/engine/config/tcp.go:39 +0xf8
exit status 2
i see,objectEncoding prop should be float64. However it got something else
i fixed it.
objectEncoding := cmd.Object["objectEncoding"] // AMF编码方法
switch v := objectEncoding.(type) {
case float64:
nc.objectEncoding = v
default:
nc.objectEncoding = 0
}
i fixed it.
objectEncoding := cmd.Object["objectEncoding"] // AMF编码方法 switch v := objectEncoding.(type) { case float64: nc.objectEncoding = v default: nc.objectEncoding = 0 }
FYI, this another client works , after you fixed above, but ffmpeg doesnt, weird, hope u have time look into it
i confused. ffmpeg doesn't work means what?
what i mean is , when i use another client, to push rtmp, it can successfully relay to rtmps but if i push to rtmp with below ffmpeg command, the streaming does not work.....
ffmpeg -re -i rtsp://xxxxxxx -c:v libx264 -f flv rtmp://localhost/live/test
config.yaml
rtmp:
push:
push: -1
pushlist:
live/test: rtmps://abcd.com/app/key
when i use another client to push to rtmp://localhost/live/test i can see the stream at rtmps://abcd.com/app/key
so maybe let me submit the PR, and close this issue it seems that the ffmpeg convert from rtsp to rtmp has problem but is out of scope of this issue.
ok, i agree
ok, please review #17
if not, can this be considered?