ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
24.75k stars 5.28k forks source link

Forward to External RTMP Servers (Twitch, Youtube, and etc.) #3872

Closed aramdata closed 7 months ago

aramdata commented 7 months ago

Describe the bug We added dynamic forward feature to our config in order to re-stream a video on multi external RTMP servers (like Youtube). The Question is: The forward feature is only works with SRS RTMP servers or It works with any RTMP?

Version SRS 5.6-b6

Logs

[2023-11-11 18:03:43.891][INFO][254][nrke4696] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
[2023-11-11 18:03:43.891][INFO][254][s0esw990] Forwarder: Start forward relay.mirol.ir/live/xxxxxxxxx of source=[nrke4696] to relay.mirol.ir:1935
[2023-11-11 18:03:43.907][INFO][254][nrke4696] got metadata, width=1920, height=1080, vcodec=7, acodec=10
[2023-11-11 18:03:43.965][INFO][254][s0esw990] complex handshake success.
[2023-11-11 18:03:43.966][INFO][254][s0esw990] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-11-11 18:03:44.059][INFO][254][s0esw990] connected, version=0.0.0.0, ip=, pid=0, id=0, dsu=1
[2023-11-11 18:03:44.184][WARN][254][s0esw990][104] Forwarder: Ignore error, code=1007(SocketRead)(Socket read data failed) : forward : receive control message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : read
thread [254][s0esw990]: do_cycle() [./src/app/srs_app_forward.cpp:235][errno=104]
thread [254][s0esw990]: forward() [./src/app/srs_app_forward.cpp:281][errno=104]
thread [254][s0esw990]: recv_message() [./src/protocol/srs_protocol_rtmp_stack.cpp:341][errno=104]
thread [254][s0esw990]: recv_interlaced_message() [./src/protocol/srs_protocol_rtmp_stack.cpp:798][errno=104]
thread [254][s0esw990]: read_basic_header() [./src/protocol/srs_protocol_rtmp_stack.cpp:893][errno=104]
thread [254][s0esw990]: grow() [./src/protocol/srs_protocol_stream.cpp:162][errno=104]
thread [254][s0esw990]: read() [./src/protocol/srs_protocol_st.cpp:566][errno=104]
[2023-11-11 18:03:44.957][INFO][254][nrke4696] 7B audio sh, codec(10, profile=LC, 2channels, 0kbps, 48000HZ), flv(16bits, 2channels, 44100HZ)
[2023-11-11 18:03:44.958][INFO][254][nrke4696] 50B video sh,  codec(7, profile=High, level=4, 1920x1080, 0kbps, 0.0fps, 0.0s)
[2023-11-11 18:03:47.229][INFO][254][s0esw990] complex handshake success.
[2023-11-11 18:03:47.230][INFO][254][s0esw990] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-11-11 18:03:47.291][INFO][254][i6j8sa8r] Hybrid cpu=1.61%,37MB, cid=23,0, timer=56,0,0, clock=1,12,23,2,3,1,1,0,0, objs=(pkt:0,raw:0,fua:0,msg:387,oth:0,buf:0)
[2023-11-11 18:03:47.298][INFO][254][s0esw990] connected, version=0.0.0.0, ip=, pid=0, id=0, dsu=1
[2023-11-11 18:03:47.427][WARN][254][s0esw990][104] Forwarder: Ignore error, code=1007(SocketRead)(Socket read data failed) : forward : receive control message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : read
thread [254][s0esw990]: do_cycle() [./src/app/srs_app_forward.cpp:235][errno=104]
thread [254][s0esw990]: forward() [./src/app/srs_app_forward.cpp:281][errno=104]
thread [254][s0esw990]: recv_message() [./src/protocol/srs_protocol_rtmp_stack.cpp:341][errno=104]
thread [254][s0esw990]: recv_interlaced_message() [./src/protocol/srs_protocol_rtmp_stack.cpp:798][errno=104]
thread [254][s0esw990]: read_basic_header() [./src/protocol/srs_protocol_rtmp_stack.cpp:893][errno=104]
thread [254][s0esw990]: grow() [./src/protocol/srs_protocol_stream.cpp:162][errno=104]
thread [254][s0esw990]: read() [./src/protocol/srs_protocol_st.cpp:566][errno=104]

Expected behavior My Video re-steam to external RTMP servers.

winlinvip commented 7 months ago

To forward to other platforms and protocols such as RTMPS or even RTSP, you can use the SRS Stack. Refer to this link for more information: https://blog.ossrs.io/maximize-your-live-streaming-reach-a-guide-to-multi-platform-streaming-38be22beec57

TRANS_BY_GPT4