how does rtp_forward work?

2,214 views
Skip to first unread message

John Smith

unread,
Apr 16, 2016, 5:14:05 PM4/16/16
to meetecho-janus
Hi, I found janus after trying numerous other webrtc clients and so far this is the best/easist to play around with

I've been reading the docs and API and can't figure out how to use rtp_forward method, I know it's not documented and I called it successfully:

{
   "janus": "success",
   "session_id": 565229388,
   "sender": 3025757774,
   "transaction": "o4vup0qoomd",
   "plugindata": {
      "plugin": "janus.plugin.videoroom",
      "data": {
         "publisher_id": 2533740941,
         "rtp_stream": {
            "audio_stream_id": 749883072,
            "audio": 5000,
            "video_stream_id": 660310857,
            "video": 5002,
            "host": "127.0.0.1"
         },
         "room": 1234,
         "videoroom": "rtp_forward"
      }
   }


but do I need to run gstreamer (gstreamer1.0) and let it listen on a port(5002) and janus pushes the udp stream to gstreamer's port
or does janus just listen to the rtp_forward port and I use ffmpeg/gstreamer to PULL the stream instead?

I am very familiar with ffmpeg (pulling/transcoding streams) but just learned about gstreamer and rtp in general, so I apologize if these are basic questions
and very appreciate if you could provide a sample gstreamer/ffmpeg commandline params to use


Lorenzo Miniero

unread,
Apr 16, 2016, 8:58:03 PM4/16/16
to meetecho-janus
rtp_forward simply sends incoming data from a WebRTC user to the ip/port you specify, so it's a push by Janus: you need to have something listening there yourself, whatever that is (gstreamer, ffmpeg, other), the plugin won't do it for you.

L.

John Smith

unread,
Apr 16, 2016, 9:14:28 PM4/16/16
to meetecho-janus
Thanks for the quick answer!  but I must be using a old version or something because after I forward a stream I noticed there is 2 new ports listening, and can use netcat to see the binary data and can use netcat's output to write to a file (of plain raw binary data)

I am using docker, so maybe that has something to do with it?

I have been pulling my hair out all day can you PLEASE show me a ffmpeg param to use to capture the stream? I tried udp, rtsp but nothing seems to work only netcat

Lorenzo Miniero

unread,
Apr 16, 2016, 9:16:41 PM4/16/16
to meetecho-janus
Sorry, I'm abroad with limited connectivity and far from my workstation. For FFmpeg you need an SDP to receive the media via RTP, not plain UDP. Try looking in old posts for examples, or wait for somebody to provide their own.

L.

John Smith

unread,
Apr 16, 2016, 9:53:51 PM4/16/16
to meetecho-janus
No problem, enjoy your weekend I have a new search term that should keep me busy for a while :-/ thanks again for the quick replies!

Амнон Исраэли

unread,
Apr 17, 2016, 3:04:05 AM4/17/16
to meetecho-janus
ffmpeg does not work good. streamer is better

gst-launch-1.0 udpsrc port=PORT caps="application/x-rtp, media=video, payload=100, clock-rate=90000, encoding-name=VP8-DRAFT-IETF-01"  ! rtpvp8depay ! queue ! ....

John Smith

unread,
Apr 17, 2016, 5:14:55 AM4/17/16
to meetecho-janus
Thanks!

I don't use a desktop environment so not familiar with gstreamer but I just pasted your commandline and just added ! filesink location=test.mp4

 and it created a file with binary data same as netcat's, but unable to open it  (in any media player)

Is there another step after that?

maybe rtp_forwarad is not what I need but I want to have a stream I could use in ffmpeg to save to file and trancode to rtmp, push it to a rtmp server, etc.

Mikael Boman

unread,
Apr 17, 2016, 7:59:38 AM4/17/16
to meetecho-janus
Perhaps not what you want to do (assume you want to convert "on-the-fly" to RTMP) but if you do not need real time you may just simply record the stream in janus (as .mjr) and use jnaus post processing tool to convert it to e.g. .webm/.opus These files can then likely be transcoded  (e.g. by ffmpeg) and streamed as RTMP.
/M 

John Smith

unread,
Apr 17, 2016, 1:19:22 PM4/17/16
to meetecho-janus
Yes that would be easiser to record but unfortunately I need real time sorry if that wasn't clear, I just need to get a broadcaster's live stream (not interested in peer to peer, sip/turn server,etc) so I can use janus as a live rtmp server replacement basically

Амнон Исраэли

unread,
Apr 18, 2016, 11:40:35 AM4/18/16
to meetecho-janus
RTMP not good for real time and mix WebRTC with RTMP, don't think that it's good idea.
RTMP must use h264 and aac codecs so you need to convert on fly from VP8 and opus or maybe only opus to aac if you video is h264.

Lorenzo Miniero

unread,
Apr 18, 2016, 11:49:28 AM4/18/16
to Амнон Исраэли, meetecho-janus

Rtp_forward + ffmpeg + rtmp is definitely possible, we did that some time ago for a custom project. Again, you just need the right sdp file for ffmpeg to receive the stream.

L.

Il 18/apr/2016 17:40, "Амнон Исраэли" <amn...@gmail.com> ha scritto:
RTMP not good for real time and mix WebRTC with RTMP, don't think that it's good idea.
RTMP must use h264 and aac codecs so you need to convert on fly from VP8 and opus or maybe only opus to aac if you video is h264.

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

István Ferenc Tóth

unread,
Sep 10, 2017, 1:53:25 PM9/10/17
to meetecho-janus
Hello

I have a configured .sdp file, everythings seems to be all right, only the ffmpeg not find a video stream - the audio works okay, and it's go to RTMP.

I have a default configuration with VP8.

By the way, if you enforce the h264|vp9 codec oin videoroom.cfg, still start room with VP8 codec...

Lorenzo Miniero

unread,
Sep 11, 2017, 5:21:10 AM9/11/17
to meetecho-janus
Il giorno domenica 10 settembre 2017 19:53:25 UTC+2, István Ferenc Tóth ha scritto:
Hello

I have a configured .sdp file, everythings seems to be all right, only the ffmpeg not find a video stream - the audio works okay, and it's go to RTMP.

I have a default configuration with VP8.

By the way, if you enforce the h264|vp9 codec oin videoroom.cfg, still start room with VP8 codec...



No, if you enforce a different codec in videoroom.cfg, that codec will be used. If it's not working for you, you're doing something wrong.

L.
Reply all
Reply to author
Forward
0 new messages