Closed opo2000tw closed 2 years ago
做了以下嘗試
關閉自動清空 group
先給他 group sub 對象,輸入:ffplay rtmp://127.0.0.1/liveedge/amtb,返回以下 json
{
"error_code": 0,
"desp": "succ",
"data": {
"groups": [
{
"stream_name": "amtb",
"audio_codec": "",
"video_codec": "",
"video_width": 0,
"video_height": 0,
"pub": {
"protocol": "",
"session_id": "",
"remote_addr": "",
"start_time": "",
"read_bytes_sum": 0,
"wrote_bytes_sum": 0,
"bitrate": 0,
"read_bitrate": 0,
"write_bitrate": 0
},
"subs": [
{
"protocol": "RTMP",
"session_id": "RTMPPUBSUB2",
"remote_addr": "127.0.0.1:61227",
"start_time": "2021-11-29 14:53:24.759",
"read_bytes_sum": 3449,
"wrote_bytes_sum": 3527,
"bitrate": 0,
"read_bitrate": 0,
"write_bitrate": 0
}
],
"pull": {
"protocol": "",
"session_id": "",
"remote_addr": "",
"start_time": "",
"read_bytes_sum": 0,
"wrote_bytes_sum": 0,
"bitrate": 0,
"read_bitrate": 0,
"write_bitrate": 0
}
}
]
}
}
輸入指令 curl -H "Content-Type:application/json" -X POST -d '{"protocol": "rtmp", "addr":"hk2.hwadzan.com:1935", "app_name":"liveedge", "stream_name":"amtb"}' http://127.0.0.1:8083/api/ctrl/start_pull
錯誤訊息
2021/11/29 14:57:17.530388 INFO http api start pull. req info={Protocol:rtmp Addr:hk2.hwadzan.com:1935 AppName:liveedge StreamName:amtb UrlParam:} - http_api.go:115
2021/11/29 14:57:17.530440 INFO [GROUP1] start relay pull. url=rtmp://hk2.hwadzan.com:1935/liveedge/amtb - group.go:1303
2021/11/29 14:57:17.530513 INFO [RTMPPULL3] lifecycle new rtmp ClientSession. session=0xc00011a400 - client_session.go:120
2021/11/29 14:57:17.530557 DEBUG [RTMPPULL3] Do. url=rtmp://hk2.hwadzan.com:1935/liveedge/amtb - client_session.go:126
2021/11/29 14:57:17.530640 INFO [RTMPPULL3] > tcp connect. - client_session.go:299
2021/11/29 14:57:17.563579 DEBUG [NAZACONN5] lifecycle new connection. net.Conn=0xc0000b6410, naza.Connection=0xc0000e29a0 - connection.go:192
2021/11/29 14:57:17.563649 INFO [RTMPPULL3] > W Handshake C0+C1. - client_session.go:317
2021/11/29 14:57:17.596959 INFO [RTMPPULL3] < R Handshake S0+S1. - client_session.go:325
2021/11/29 14:57:17.597040 INFO [RTMPPULL3] > W Handshake C2. - client_session.go:327
2021/11/29 14:57:17.597109 INFO [RTMPPULL3] < R Handshake S2. - client_session.go:335
2021/11/29 14:57:17.597163 INFO [RTMPPULL3] > W SetChunkSize 4096. - client_session.go:248
2021/11/29 14:57:17.597220 INFO [RTMPPULL3] > W connect('liveedge'). tcUrl=rtmp://hk2.hwadzan.com:1935/liveedge - client_session.go:254
2021/11/29 14:57:17.631139 INFO [RTMPPULL3] < R Window Acknowledgement Size: 2500000 - client_session.go:518
2021/11/29 14:57:17.631194 WARN [RTMPPULL3] < R Set Peer Bandwidth. ignore. - client_session.go:521
2021/11/29 14:57:17.631221 WARN [RTMPPULL3] read user control message, ignore. buf=00000000 00 00 00 00 00 00 |......|
- client_session.go:362
2021/11/29 14:57:17.631242 INFO [RTMPPULL3] < R Set Chunk Size 4096. - client_session.go:524
2021/11/29 14:57:17.631271 WARN amf ReadArray without suffix Amf0TypeMarkerObjectEndBytes. - amf0.go:381
2021/11/29 14:57:17.631308 INFO [RTMPPULL3] < R _result("NetConnection.Connect.Success"). - client_session.go:474
2021/11/29 14:57:17.631325 INFO [RTMPPULL3] > W createStream(). - client_session.go:475
2021/11/29 14:57:17.664283 INFO [RTMPPULL3] < R _result(). - client_session.go:491
2021/11/29 14:57:17.664328 INFO [RTMPPULL3] > W play('amtb'). - client_session.go:494
2021/11/29 14:57:22.535206 INFO [RTMPPULL3] lifecycle dispose rtmp ClientSession. err=<nil> - client_session.go:550
2021/11/29 14:57:22.535326 DEBUG [NAZACONN5] Close. - connection.go:376
2021/11/29 14:57:22.535354 DEBUG [NAZACONN5] close once. err=<nil> - connection.go:504
2021/11/29 14:57:22.535446 ERROR [RTMPPULL3] relay pull fail. err=context deadline exceeded - group.go:1313
2021/11/29 14:57:22.535490 DEBUG [GROUP1] [RTMPPULL3] del rtmp PullSession from group. - group.go:680
已用過以下測試源
ffplay rtmp://127.0.0.1:1935/liveedge/amtb
curl -H "Content-Type:application/json" -X POST -d '{"protocol": "rtmp", "addr":"61.93.225.146:1935", "app_name":"liveedge", "stream_name":"amtb"}' http://127.0.0.1:8083/api/ctrl/start_pull
2021/11/29 15:26:53.992769 ERROR [RTMPPULL1] relay pull fail. err=context deadline exceeded - group.go:1313 2021/11/29 15:26:53.992847 DEBUG [GROUP1] [RTMPPULL1] del rtmp PullSession from group. - group.go:680
2.
ffplay rtmp://127.0.0.1:1935/dmb/ydlive_20140419_1
curl -H "Content-Type:application/json" -X POST -d '{"protocol": "rtmp", "addr":"1.255.48.202:1935", "app_name":"dmb", "stream_name":"ydlive_20140419_1"}' http://127.0.0.1:8083/api/ctrl/start_pull
進入 panic lalserver 主程式死亡
3.
ffplay rtmp://127.0.0.1:1935/cbs-live/cbs-live.stream
curl -H "Content-Type:application/json" -X POST -d '{"protocol": "rtmp", "addr":"101.79.245.175:1935", "app_name":"cbs-live", "stream_name":"cbs-live.stream", "url_param":""}' http://127.0.0.1:8083/api/ctrl/start_pull
進入 panic lalserver 程式死亡
詳見以下 2. --> 從程式開始到進入 panic lalserver 程式死亡
GOROOT=/usr/local/opt/go/libexec #gosetup GOPATH=/Users/blakewu/go #gosetup /usr/local/opt/go/libexec/bin/go build -o /private/var/folders/7c/6l1tr8_53w501pny7tp41x840000gn/T/GoLand/_go_build_main_go -gcflags all=-N -l /Volumes/Case/go/fork/lal/app/lalserver/main.go #gosetup /Applications/GoLand.app/Contents/plugins/go/lib/dlv/mac/dlv --listen=127.0.0.1:56438 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /private/var/folders/7c/6l1tr853w501pny7tp41x840000gn/T/GoLand/go_build_main_go -- API server listening at: 127.0.0.1:56438 debugserver-@(#)PROGRAM:LLDB PROJECT:lldb-1200.0.44 for x86_64. Got a connection, launched process /private/var/folders/7c/6l1tr8_53w501pny7tp41x840000gn/T/GoLand/___go_build_main_go (pid = 86860). 2021/11/29 15:59:39.960082 WARN config file did not specify in the command line, try to load it in the usual path. - main.go:52 2021/11/29 15:59:39.960619 WARN lalserver.conf.json not exist. - main.go:68 2021/11/29 15:59:39.960636 WARN ./conf/lalserver.conf.json exist. using it as config file. - main.go:65 2021/11/29 15:59:39.963486 INFO initial log succ. - config.go:210 2021/11/29 15:59:39.963754 INFO
/ / / | / / / / / /| | / / / // |/ /_ /___// |/_____/
goroutine 84 [running]: github.com/q191201771/lal/pkg/base.RtmpMsg.IsAacSeqHeader({{0x6, 0x0, 0x8, 0x1, 0x0}, {0x0, 0x0, 0x0}}) /Volumes/Case/go/fork/lal/pkg/base/rtmp_t.go:114 +0xbb github.com/q191201771/lal/pkg/remux.(GopCache).Feed(0xc000149f40, {{0x6, 0x0, 0x8, 0x1, 0x0}, {0x0, 0x0, 0x0}}, 0xc000125298) /Volumes/Case/go/fork/lal/pkg/remux/gop_cache.go:93 +0xd0 github.com/q191201771/lal/pkg/logic.(Group).broadcastByRtmpMsg(0xc0001a6a00, {{0x6, 0x0, 0x8, 0x1, 0x0}, {0x0, 0x0, 0x0}}) /Volumes/Case/go/fork/lal/pkg/logic/group.go:1149 +0x126d github.com/q191201771/lal/pkg/logic.(Group).OnReadRtmpAvMsg(0xc0001a6a00, {{0x6, 0x0, 0x8, 0x1, 0x0}, {0x0, 0x0, 0x0}}) /Volumes/Case/go/fork/lal/pkg/logic/group.go:918 +0x145 github.com/q191201771/lal/pkg/rtmp.(ClientSession).doMsg(0xc0003e6000, 0xc0004a4750) /Volumes/Case/go/fork/lal/pkg/rtmp/client_session.go:368 +0x409 github.com/q191201771/lal/pkg/rtmp.(ChunkComposer).RunLoop(0xc00039a440, {0x5b7d3c0, 0xc0004c0210}, 0xc000125da0) /Volumes/Case/go/fork/lal/pkg/rtmp/chunk_composer.go:238 +0xdbd github.com/q191201771/lal/pkg/rtmp.(ClientSession).runReadLoop(0xc0003e6000) /Volumes/Case/go/fork/lal/pkg/rtmp/client_session.go:340 +0xb2 github.com/q191201771/lal/pkg/rtmp.(ClientSession).doContext.func1() /Volumes/Case/go/fork/lal/pkg/rtmp/client_session.go:260 +0x618 created by github.com/q191201771/lal/pkg/rtmp.(ClientSession).doContext /Volumes/Case/go/fork/lal/pkg/rtmp/client_session.go:233 +0x12d Exiting.
Debugger finished with the exit code 0
感谢反馈,对您的三次留言依次回复:
1) http api中的start pull当前常见的用法是,有播放端从lalserver拉流,流不存在,从远端pull至本地,供拉流端使用。当本地没有拉这路流的播放者时,不再pull。设计的初衷是按需pull,节约资源。
2) 看日志是发起了pull动作,但是在发送完rtmp play信令后,没有收到相对应的结果信令,最终达到超时时间,本端主动停止了pull会话。
该测试中的rtmp://hk2.hwadzan.com/liveedge/amtb
我tcp建联失败(可能是网络原因),你用ffplay播放这个流是正常的吗?
3) panic的问题我会尽快定位并修复
感谢。
3.2中的panic的问题我已经修复,你可以继续测试了。(panic的原因是源流的rtmp协议不太标准)
dispatch.go
2021/11/30 04:55:14.806995 INFO [ReqID2733] on_sub_start. info={SessionEventCommonInfo:{Protocol:rtmp://127.0.0.1:1935/live/test SessionId:RTMPPUBSUB3 RemoteAddr:127.0.0.1:62562 ServerId:1 Url: AppName:live StreamName:test UrlParam: HasInSession:false HasOutSession:true}} - dispatch.go:118
2021/11/30 04:55:14.807015 INFO [ReqID2733] pub not exist, ignore. - dispatch.go:142
輸入 /api/ctrl/start_pull ...
dispatch.go 2021/11/30 05:15:46.351803 INFO [ReqID42] on_sub_stop. info={SessionEventCommonInfo:{Protocol:RTMP SessionId:RTMPPUBSUB4 RemoteAddr:127.0.0.1:63251 ServerId:1 Url: AppName:cbs-live StreamName:cbs-live.stream UrlParam: HasInSession:false HasOutSession:false}} - dispatch.go:172 2021/11/30 05:15:50.351280 INFO [ReqID43] on_update. info={ServerId:1 Groups:[]} - dispatch.go:183
2. 用 ffplay 播放皆**正常**,不確定 hk2.hwadzan.com 在大陸是否會被擋 ip,因為是佛教網站
佛教2,rtmp://hk2.hwadzan.com/liveedge/amtb
佛教4,rtmp://hk2.hwadzan.com/liveedgelist/livetv
/Volumes/Case/go/fork/lal/lal_record tags/v0.26.0* 2m 17s ❯ ffplay rtmp://hk2.hwadzan.com/liveedge/amtb ffplay version 4.4.1 Copyright (c) 2003-2021 the FFmpeg developers built with Apple clang version 12.0.0 (clang-1200.0.32.29) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Input #0, flv, from 'rtmp://hk2.hwadzan.com/liveedge/amtb': f=0/0 Metadata: |RtmpSampleAccess: false length : 100236864 timescale : 48000 sampletype : mp4a audiochannels : 2 videoframerate : 30 aacaot : 2 avclevel : 31 avcprofile : 77 frameWidth : 1280 frameHeight : 720 displayWidth : 1280 displayHeight : 720 moovposition : 40 Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Data: none Stream #0:1: Video: h264 (Main), yuv420p(progressive), 1280x720, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp 17.75 A-V: -0.004 fd= 187 aq= 0KB vq= 0KB sq= 0B f=88/45
> 没有收到相对应的结果信令,最终达到超时时间,本端主动停止了pull会话。
**我會再去做確認,指令和地址應該是沒有問題,log如下**
GOROOT=/usr/local/opt/go/libexec #gosetup GOPATH=/Users/blakewu/go #gosetup /usr/local/opt/go/libexec/bin/go build -o /private/var/folders/7c/6l1tr8_53w501pny7tp41x840000gn/T/GoLand/_go_build_main_go -gcflags all=-N -l /Volumes/Case/go/fork/lal/app/lalserver/main.go #gosetup /Applications/GoLand.app/Contents/plugins/go/lib/dlv/mac/dlv --listen=127.0.0.1:64829 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /private/var/folders/7c/6l1tr853w501pny7tp41x840000gn/T/GoLand/go_build_main_go -- API server listening at: 127.0.0.1:64829 debugserver-@(#)PROGRAM:LLDB PROJECT:lldb-1200.0.44 for x86_64. Got a connection, launched process /private/var/folders/7c/6l1tr8_53w501pny7tp41x840000gn/T/GoLand/___go_build_main_go (pid = 34344). 2021/11/30 06:08:59.069284 WARN config file did not specify in the command line, try to load it in the usual path. - main.go:52 2021/11/30 06:08:59.070343 WARN lalserver.conf.json not exist. - main.go:68 2021/11/30 06:08:59.070377 WARN ./conf/lalserver.conf.json exist. using it as config file. - main.go:65 2021/11/30 06:08:59.073645 INFO initial log succ. - config.go:210 2021/11/30 06:08:59.073934 INFO
/ / / | / / / / / /| | / / / // |/ /_ /___// |/_____/
3. 已測試可以播放
**您那邊有比較標準規範的 rtmp server 網址或是推薦使用哪個軟體可以簡單的測試?**
還有以下兩個問題想請問您。是否要開新討論串?
mcu -> rtsp tcp 1280p的條件下 rtsp
-> ffplay (1.2秒)
pullrtsp2rtsp
-> FLV, HLS, MPEGTS, RTMP
-> ffplay
1. FLV 會慢到出現 timestamp 錯誤
2. HLS 太慢(10-15 sec)
3. 未嘗試:MPEGTS
4. rtmp(5 sec)播放器端麻煩,顯示想用 js 寫大概率只能用 popup 去 call 播放器
感謝
HTTP-API控制的relay pull回源拉流功能已支持rtsp协议,可以试试,文档见: https://pengrl.com/lal/#/HTTPAPI?id=_21-apictrlstart_relay_pull
这个功能已经完成,issue先关闭了,有需要请重新打开或创建新的issue,感谢。
頻道地址:佛教2,rtmp://hk2.hwadzan.com/liveedge/amtb
測試播放:ffplay rtmp://hk2.hwadzan.com/liveedge/amtb
錯誤訊息: lalserver.go
可以給個範例或是說明以上兩個怎麼使用嗎?
不太懂這邊的流程和指令應該怎麼下。謝謝
我的理解是 1. 指令要拉取遠端流,卻去判斷 group 是否存在? 這不是很奇怪嗎