Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用pullrtsp2pushrtsp拉RTSP视频流转到其他RTSP服务器时出错,连接断开,转到lal的RTSP服务器正常 #354

Open
viccom opened this issue May 7, 2024 · 1 comment

Comments

@viccom
Copy link

viccom commented May 7, 2024

测试环境:服务器和测试客户端都是Linux(Ubuntu22.04)
服务器:在服务器上部署了多个RTSP服务器,其中服务器1部署lal,服务器2部署go2rtc,服务器3部署mediamtx
测试客户端:pullrtsp2pushrtsp,ffmpeg

测试过程:

  1. 使用pullrtsp2pushrtsp分别将本地网络的rtsp视频源拉流转推到rtsp服务器,命令如下:
    pullrtsp2pushrtsp -i rtsp://admin:[email protected]:554/h264/ch1/main/av_stream -o rtsp://xxxx.com:8554/camera1 -t 1 -y 1
    上面命令除了目的rtsp地址不一样,其他都一样,测试结果:
    1)lal服务器接收正常,在Windows端使用potplayer可正常看实时视频。
    2)go2rtc服务器无法接收,go2rtc服务器端报错:undefined error=wrong content type caller=github.com/AlexxIT/go2rtc/internal/rtsp/rtsp.go:225;pullrtsp2pushrtsp发送端报错:start tunnel failed. err=EOF([] header.go:50) - pullrtsp2pushrtsp.go:169
    3)mediamtx服务器无法接收,错误信息和2)差不多。

  2. 使用ffmpeg 分别将本地网络的rtsp视频源拉流转推到rtsp服务器,命令如下:
    ffmpeg -fflags +genpts -rtsp_transport tcp -i rtsp://admin:[email protected]:554/h264/ch1/main/av_stream -vcodec copy -f rtsp rtsp://xxxx.com:8554/camera1
    测试结果:
    1)go2rtc服务器接收正常,在Windows端使用potplayer可正常看实时视频。
    2)mediamtx服务器接收正常,在Windows端使用potplayer可正常看实时视频。

3)lal服务器无法接收,服务器运行日志如下:
2024/05/07 15:19:24.575953 DEBUG [NAZACONN6] lifecycle new connection. net.Conn=0xc000054200, naza.Connection=0xc00008e370 - connection.go:193
2024/05/07 15:19:24.576006 INFO [RTSPSRVCMD6] lifecycle new rtsp ServerSession. session=0xc0001243c0, laddr=172.17.12.89:8554, raddr=124.88.238.108:41026, iswebsocket:false - server_command_session.go:89
2024/05/07 15:19:24.576346 DEBUG [RTSPSRVCMD6] read http request. method=OPTIONS, uri=rtsp://m2mio.com:8554/camera1, version=RTSP/1.0, headers=map[Cseq:[1] User-Agent:[Lavf58.76.100]], body= - server_command_session.go:213
2024/05/07 15:19:24.576373 INFO [RTSPSRVCMD6] < R OPTIONS - server_command_session.go:256
2024/05/07 15:19:24.791285 DEBUG [RTSPSRVCMD6] read http request. method=ANNOUNCE, uri=rtsp://m2mio.com:8554/camera1, version=RTSP/1.0, headers=map[Content-Length:[493] Content-Type:[application/sdp] Cseq:[2] User-Agent:[Lavf58.76.100]], body=v=0
o=- 0 0 IN IP4 127.0.0.1
s=Media Presentation
c=IN IP4 39.107.138.114
t=0 0
a=tool:libavformat 58.76.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z00AM4qKcB4AIff+AAIAAtgI,aO48gA==; profile-level-id=4D0033
a=control:streamid=0
m=audio 0 RTP/AVP 97
b=AS:69
a=rtpmap:97 MPEG4-GENERIC/16000/1
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=140856E500
a=control:streamid=1

  • server_command_session.go:213
    2024/05/07 15:19:24.791361 INFO [RTSPSRVCMD6] < R ANNOUNCE - server_command_session.go:267
    2024/05/07 15:19:24.791415 INFO [RTSPPUB4] lifecycle new rtsp BaseInSession. session=0xc0000ccb08 - base_in_session.go:94
    2024/05/07 15:19:24.791431 INFO [RTSPPUB4] lifecycle new rtsp PubSession. session=0xc0000c8d80, streamName=camera1 - server_pub_session.go:38
    2024/05/07 15:19:24.791440 INFO [RTSPSRVCMD6] link new PubSession. [RTSPPUB4] - server_command_session.go:282
    2024/05/07 15:19:24.791455 DEBUG DefaultRtpUnpackerFactory. type=97, clockRate=16000, maxSize=1024 - rtp_unpacker.go:74
    2024/05/07 15:19:24.791466 DEBUG DefaultRtpUnpackerFactory. type=96, clockRate=90000, maxSize=1024 - rtp_unpacker.go:74
    2024/05/07 15:19:24.791490 INFO [GROUP4] lifecycle new group. group=0xc000004a88, appName=, streamName=camera1 - group__.go:185
    2024/05/07 15:19:24.791508 DEBUG [GROUP4] [RTSPPUB4] add RTSP PubSession into group. - group__in.go:86
    2024/05/07 15:19:24.791831 DEBUG [RTMP2MPEGTS4] NewRtmp2MpegtsRemuxer - rtmp2mpegts.go:117
    2024/05/07 15:19:24.791844 DEBUG [GROUP4] [RTMP2MPEGTS4] NewRtmp2MpegtsRemuxer in group. - group__in.go:357
    2024/05/07 15:19:24.791863 INFO [HLSMUXER4] lifecycle new hls muxer. muxer=0xc0001962d0, streamName=camera1 - muxer.go:116
    2024/05/07 15:19:24.791873 INFO [HLSMUXER4] start hls muxer. - muxer.go:121
    2024/05/07 15:19:24.791978 DEBUG sps={ProfileIdc:77 ConstraintSet0Flag:0 ConstraintSet1Flag:0 ConstraintSet2Flag:0 LevelIdc:51 SpsId:0 ChromaFormatIdc:1 ResidualColorTransformFlag:0 BitDepthLuma:8 BitDepthChroma:8 TransFormBypass:0 Log2MaxFrameNumMinus4:9 PicOrderCntType:0 Log2MaxPicOrderCntLsb:13 NumRefFrames:2 GapsInFrameNumValueAllowedFlag:1 PicWidthInMbsMinusOne:239 PicHeightInMapUnitsMinusOne:134 FrameMbsOnlyFlag:1 MbAdaptiveFrameFieldFlag:0 Direct8X8InferenceFlag:1 FrameCroppingFlag:0 FrameCropLeftOffset:0 FrameCropRightOffset:0 FrameCropTopOffset:0 FrameCropBottomOffset:0 SarNum:1 SarDen:1} - beta.go:41
    2024/05/07 15:19:24.792024 DEBUG [GROUP4] metadata. err=, len=4, value=audiocodecid: 10
    videocodecid: 7
    version: lal0.37.4
    lal: 0.37.4
  • group__core_streaming.go:190
    2024/05/07 15:19:24.792066 DEBUG [GROUP4] cache rtmp metadata. size:126 - gop_cache.go:93
    2024/05/07 15:19:24.792102 DEBUG [GROUP4] cache rtmp aac seq header. size:19 - gop_cache.go:109
    2024/05/07 15:19:24.792133 DEBUG [GROUP4] cache rtmp video seq header. size:50 - gop_cache.go:115
    2024/05/07 15:19:24.792158 DEBUG sps={ProfileIdc:77 ConstraintSet0Flag:0 ConstraintSet1Flag:0 ConstraintSet2Flag:0 LevelIdc:51 SpsId:0 ChromaFormatIdc:1 ResidualColorTransformFlag:0 BitDepthLuma:8 BitDepthChroma:8 TransFormBypass:0 Log2MaxFrameNumMinus4:9 PicOrderCntType:0 Log2MaxPicOrderCntLsb:13 NumRefFrames:2 GapsInFrameNumValueAllowedFlag:1 PicWidthInMbsMinusOne:239 PicHeightInMapUnitsMinusOne:134 FrameMbsOnlyFlag:1 MbAdaptiveFrameFieldFlag:0 Direct8X8InferenceFlag:1 FrameCroppingFlag:0 FrameCropLeftOffset:0 FrameCropRightOffset:0 FrameCropTopOffset:0 FrameCropBottomOffset:0 SarNum:1 SarDen:1} - beta.go:41
    2024/05/07 15:19:24.878510 DEBUG [RTSPSRVCMD6] read http request. method=SETUP, uri=rtsp://m2mio.com:8554/camera1/streamid=0, version=RTSP/1.0, headers=map[Cseq:[3] Transport:[RTP/AVP/UDP;unicast;client_port=13446-13447;mode=record] User-Agent:[Lavf58.76.100]], body= - server_command_session.go:213
    2024/05/07 15:19:24.878578 INFO [RTSPSRVCMD6] < R SETUP - server_command_session.go:386
    2024/05/07 15:19:24.878690 DEBUG [RTSPSRVCMD6] init conn. lRtpPort=30008, lRtcpPort=30009, rRtpPort=13446, rRtcpPort=13447 - server_command_session.go:433
    2024/05/07 15:19:24.965777 DEBUG [RTSPSRVCMD6] read http request. method=SETUP, uri=rtsp://m2mio.com:8554/camera1/streamid=1, version=RTSP/1.0, headers=map[Cseq:[4] Session:[191201771] Transport:[RTP/AVP/UDP;unicast;client_port=13448-13449;mode=record] User-Agent:[Lavf58.76.100]], body= - server_command_session.go:213
    2024/05/07 15:19:24.965821 INFO [RTSPSRVCMD6] < R SETUP - server_command_session.go:386
    2024/05/07 15:19:24.965950 DEBUG [RTSPSRVCMD6] init conn. lRtpPort=30010, lRtcpPort=30011, rRtpPort=13448, rRtcpPort=13449 - server_command_session.go:433
    2024/05/07 15:19:25.052507 DEBUG [RTSPSRVCMD6] read http request. method=RECORD, uri=rtsp://m2mio.com:8554/camera1, version=RTSP/1.0, headers=map[Cseq:[5] Range:[npt=0.000-] Session:[191201771] User-Agent:[Lavf58.76.100]], body= - server_command_session.go:213
    2024/05/07 15:19:25.052546 INFO [RTSPSRVCMD6] < R RECORD - server_command_session.go:463
    2024/05/07 15:19:37.774793 WARN [GROUP4] session timeout. session=RTSPPUB4 - group__.go:459
    2024/05/07 15:19:37.774846 INFO [RTSPPUB4] lifecycle dispose rtsp PubSession. session=0xc0000c8d80 - server_pub_session.go:59
    2024/05/07 15:19:37.774858 INFO [RTSPSRVCMD6] lifecycle dispose rtsp ServerCommandSession. session=0xc0001243c0 - server_command_session.go:98
    2024/05/07 15:19:37.774865 DEBUG [NAZACONN6] Close. - connection.go:381
    2024/05/07 15:19:37.774872 DEBUG [NAZACONN6] close once. err= - connection.go:509
    2024/05/07 15:19:37.774943 INFO [RTSPPUB4] lifecycle dispose rtsp BaseInSession. session=0xc0000ccb08 - base_in_session.go:417
    2024/05/07 15:19:37.774970 ERROR [RTSPSRVCMD6] read interleaved error. err=read tcp 172.17.12.89:8554->124.88.238.108:41026: use of closed network connection - server_command_session.go:189
    2024/05/07 15:19:37.774997 DEBUG [NAZACONN6] Close. - connection.go:381
@Annlix
Copy link

Annlix commented Dec 4, 2024

有没有什么解决办法?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants