illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
6k stars 1.53k forks source link

RTMP relay is not working #398

Open rkanani108 opened 4 years ago

rkanani108 commented 4 years ago

Hi @illuspas ,

I am trying to relay published video on youtube RTMP stream but stream ended always. Debug all the FFmpeg parameter in "node_relay_session.js" which is fine and it's working if I run manually FFmpeg command in cmd.

relay settings in app.js relay: { ffmpeg: 'C:\Rakesh\cms\ffmpeg\bin\ffmpeg.exe', tasks: [ { app: 'live', mode: 'push', edge: 'rtmp://a.rtmp.youtube.com/live2/key', appendName: false }, ], }

Following is the log. [NodeEvent on prePublish] id=HZHOUMM1 StreamPath=/live/rkanani args={} 9/18/2020 10:04:16 37704 [INFO] [rtmp publish] New stream. id=HZHOUMM1 streamPath=/live/rkanani streamId=1 [NodeEvent on postPublish] id=HZHOUMM1 StreamPath=/live/rkanani args={} 9/18/2020 10:04:16 37704 [INFO] =======> "flv" 9/18/2020 10:04:16 37704 [INFO] =======> "rtmp://a.rtmp.youtube.com/live2/key" 9/18/2020 10:04:16 37704 [INFO] =======> "rtmp://127.0.0.1:1935/live/rkanani" 9/18/2020 10:04:16 37704 [INFO] =======> C:\user\cms\ffmpeg\bin\ffmpeg.exe 9/18/2020 10:04:16 37704 [INFO] [Relay dynamic push] start HZHOUMM1 rtmp://127.0.0.1:1935/live/rkanani to rtmp://a.rtmp.youtube.com/live2/key 9/18/2020 10:04:16 37704 [INFO] [rtmp publish] Handle video. id=HZHOUMM1 streamPath=/live/rkanani frame_type=1 codec_id=7 codec_name=H264 1920x1080 9/18/2020 10:04:16 37704 [INFO] [rtmp publish] Handle audio. id=HZHOUMM1 streamPath=/live/rkanani sound_format=10 sound_type=2 sound_size=1 sound_rate=3 codec_name=AAC 48000 2ch 9/18/2020 10:04:17 37704 [INFO] [Relay end] id= HZHOUMM1

I referred related threads with this issue but nothing is working.

Let me know if anything needs to verify. Thanks'

ben221199 commented 4 years ago

I have the same problem, but sometimes it works and sometimes it doesn't.

Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp connect] id=3FNONUCL ip=::ffff:172.20.12.51 app=live args={"app":"live","type":"nonprivate","flashVer":"FMLE/3.0 (c
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp publish] New stream. id=3FNONUCL streamPath=/live/<STREAMNAME> streamId=1
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp play] Join stream. id=D4S1E7V7 streamPath=/live/<STREAMNAME>  streamId=1
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [Event] Connect broadcast: <STREAMNAME>
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [Transmuxing MP4] /live/<STREAMNAME> to /var/www/html/live/<STREAMNAME>/2020-11-08-09-25-19.mp4
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [Transmuxing MP4] /live/<STREAMNAME> to /var/www/html/live/<STREAMNAME>/2020-11-08-09-25-19.mp4
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [Relay dynamic push] start 3FNONUCL rtmp://127.0.0.1:1935/live/<STREAMNAME>  to  rtmp://a.rtmp.youtube.com/live2/<STREAMKEY>
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [Relay dynamic push] start 3FNONUCL rtmp://127.0.0.1:1935/live/<STREAMNAME>  to  rtmp://a.rtmp.youtube.com/live2/<STREAMKEY>
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp connect] id=8F1QM8OF ip=::ffff:127.0.0.1 app=live args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://127
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp connect] id=M1DJ1KYF ip=::ffff:127.0.0.1 app=live args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://127
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp connect] id=GLCC5TVS ip=::ffff:127.0.0.1 app=live args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://127
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp connect] id=73VN2C7P ip=::ffff:127.0.0.1 app=live args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://127
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp play] Join stream. id=8F1QM8OF streamPath=/live/<STREAMNAME>  streamId=1
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp play] Join stream. id=M1DJ1KYF streamPath=/live/<STREAMNAME>  streamId=1
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp play] Join stream. id=GLCC5TVS streamPath=/live/<STREAMNAME>  streamId=1
Nov 08 09:25:19 debian node[12381]: 11/8/2020 09:25:19 12381 [INFO] [rtmp play] Join stream. id=73VN2C7P streamPath=/live/<STREAMNAME>  streamId=1
Nov 08 09:25:21 debian node[12381]: 11/8/2020 09:25:21 12381 [INFO] [rtmp publish] Handle audio. id=3FNONUCL streamPath=/live/<STREAMNAME> sound_format=10 sound_type=2 sound_size=1 sound_rat
Nov 08 09:25:21 debian node[12381]: 11/8/2020 09:25:21 12381 [INFO] [rtmp publish] Handle video. id=3FNONUCL streamPath=/live/<STREAMNAME> frame_type=1 codec_id=7 codec_name=H264 1920x1080
Nov 08 09:25:22 debian node[12381]: 11/8/2020 09:25:22 12381 [INFO] [rtmp play] Close stream. id=M1DJ1KYF streamPath=/live/<STREAMNAME> streamId=1
Nov 08 09:25:22 debian node[12381]: 11/8/2020 09:25:22 12381 [INFO] [rtmp disconnect] id=M1DJ1KYF
Nov 08 09:25:22 debian node[12381]: 11/8/2020 09:25:22 12381 [INFO] [Relay end] id= 3FNONUCL
Nov 08 10:03:48 debian node[12381]: 11/8/2020 10:03:48 12381 [INFO] [rtmp connect] id=DHOQ8ONZ ip=::ffff:127.0.0.1 app=live args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://127
Nov 08 10:03:48 debian node[12381]: 11/8/2020 10:03:48 12381 [INFO] [rtmp play] Join stream. id=DHOQ8ONZ streamPath=/live/<STREAMNAME>  streamId=1
Nov 08 10:04:24 debian node[12381]: 11/8/2020 10:04:24 12381 [INFO] [rtmp play] Close stream. id=DHOQ8ONZ streamPath=/live/<STREAMNAME> streamId=1
Nov 08 10:04:24 debian node[12381]: 11/8/2020 10:04:24 12381 [INFO] [rtmp disconnect] id=DHOQ8ONZ
ben221199 commented 4 years ago

image

This is a Dutch screenshot of YouTube Studio Livestream. I am using Node Media Server and I am relaying my stream to YouTube. When live, a green dot will appear, but YouTube will not go live. Looks like YouTube sees the connection, but doesn't get data.

I use this software every sunday and this is a very repeating issue. I hope there will be a fix.