Skip to content

Instantly share code, notes, and snippets.

@tmehlinger tmehlinger/run.sh
Last active Jun 9, 2019

Embed
What would you like to do?
gstreamer RTP to RTMP
#!/bin/bash
# tested on Ubuntu 16.04
apt-get install -y \
gstreamer1.0-libav \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-tools
# start gstreamer... assumes you have mediasoup configured to use Opus/H264
gst-launch-1.0 -em \
rtpbin name=rtpbin latency=5 \
udpsrc port=10000 caps="application/x-rtp,media=(string)audio,clock-rate=(int)48000,encoding-name=(string)OPUS" ! rtpbin.recv_rtp_sink_0 \
rtpbin. ! queue ! rtpopusdepay ! opusdec ! audioconvert ! audioresample ! voaacenc ! mux. \
udpsrc port=10002 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! queue ! rtph264depay ! h264parse ! mux. \
flvmux name=mux streamable=true ! rtmpsink sync=false location=rtmp://127.0.0.1:1935/stream
// snippet from the mediasoup server that actually sets up the `RtpStreamer`
room.on('newpeer', (peer) => {
peer.on('newproducer', (producer) => {
let rtpParams = {
remoteIP: '127.0.0.1',
remotePort: (producer.kind === 'audio') ? 10000 : 10002
}
room.createRtpStreamer(producer, rtpParams).then((streamer) => {
console.log('started mirroring RTP for', producer.kind);
});
});
});
@ibc

This comment has been minimized.

Copy link

commented Feb 23, 2018

It should be:

room.on('newpeer', (peer) => {
  peer.on('newproducer', (producer) => {
    let rtpParams = {
      remoteIP: '127.0.0.1',
      remotePort: (producer.kind === 'audio') ? 10000 : 10002
    };

    room.createRtpStreamer(producer, rtpParams).then((streamer) => {
      console.log('started mirroring RTP for', producer.kind);
    });
  });
};

right?

@tmehlinger

This comment has been minimized.

Copy link
Owner Author

commented Feb 23, 2018

Ha! I realized it just as you posted. You are correct, fixed now.

@klanjabrik

This comment has been minimized.

Copy link

commented Aug 3, 2018

@tmehlinger do you know how to solved: WARNING: erroneous pipeline: no element "voaacenc"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.