How can I use rtmp:// to push/pull the stream?

Hi Team,

Maybe my question looks stupid, because I’m really a beginner of webrtc developer. Could you give me some advice for using rtmp address to push/pull the live stream?

Thank you so much!

Please use the proper topic category. Also this is not a question about mediasoup.

You mean I need to integrate a RTMP server?

No, I didn’t say that clearly. This is a forum about mediasoup, and not about generic WebRTC or RTMP support.

2 Likes

Anyway, thanks for your reply.

There is no “address”, you need to write an app that speaks WebRTC or RTP on one side (to connect to mediasoup) and RTMP on the other side. Or 2 apps if they can only pull or only push.

It is possible to do with mediasoup, but I don’t think there is an off-the-shelf solution.
I have done it with GStreamer, but it requires some tinkering to generate SDP for WebRTC connection (this is what I preferred) and codecs matching both what browsers and RTMP support.

1 Like

This helped me a lot. I will try to do it. Thank you very much.

Also you may try that demo https://github.com/Kurento/mediasoup-demos/tree/master/mediasoup-recording But you have to change flv to rtmp in ffmpeg/gstreamer command

1 Like

I have already tried this demo. After I change the parameters webmux => flvmux and filesink => rtmpsink, it throws errors like that
GST_PIPELINE grammar.y:740:gst_parse_perform_link: could not link rtpvp8depay0 to mux

After many adjustments, this command works for video, but it has a high latency and reports a decode error after a few seconds.

const args = [
    `rtpbin name=rtpbin latency=50 buffer-mode=0`,
    '!',
    `udpsrc port=${video.remoteRtpPort} caps="${VIDEO_CAPS}"`,
    '!',
    'rtpbin.recv_rtp_sink_0 rtpbin.',
    '!',
    '"application/x-rtp, media=(string)video"',
    '!',
    'queue',
    '!',
    'decodebin',
    '!',
    'videoconvert',
    '!',
    'x264enc',
    '!',
    'h264parse',
    '!',
    'mux.',
    'flvmux streamable=true name=mux',
    '!',
    'rtmpsink location=rtmp://xxxxxx'
    `udpsrc address=${host} port=${video.remoteRtcpPort}`,
    '!',
    "application/x-rtcp",
    '!',
    'rtpbin.recv_rtcp_sink_0 rtpbin.send_rtcp_src_0',
    '!',
    `udpsink host=${host} port=${video.localRtcpPort} bind-address=${host} bind-port=${video.remoteRtcpPort} sync=false async=false`
]

Now, I’m learning something about gstreamer, and try that plugin https://github.com/vpalmisano/mediasoupbin.

Thanks.