[Little Help || enlightment] WebRTC->RTP->RTMP

1,525 views
Skip to first unread message

István Ferenc Tóth

unread,
Sep 10, 2017, 7:09:43 AM9/10/17
to meetecho-janus
Hi all

I successfully setup and configure a Janus gateway with HTTPS, and all the demo works perfectly - for the next step I need to create an RTP forward, then an RTMP stream.
I successfully made a RTP forwarding requests with JS API, and it's done without error.
  • How can I check that the RTP forwarding request done, and working? I check the netstat, and a new UDP port opening after the request - but the port number are seems to random (as I read it has to be) - how can I get this new port number? (With this request theoretically I can make a direct RTP stream to other server too  -with change the ip and video port, or in the JS API request that is the source IP and port number?)
  • After this I assume I have to create a .sdp file with that new port number to start the ffmpeg to create the RTMP stream. How can I create this .sdp file easiy or can I see a working example somewhere - I try numerous, but I can't make it work properly. Can it work with the original 5002-4 video-audio ports? A I read in this threads, the .sdp file can be generated dynamically after I get the new port number of the RTP forwarding. I can make that, but I need a working environment.
I really appreciate any help of this case, with answers or links to the answers.

Thank you

xiang liu

unread,
Sep 10, 2017, 7:16:46 AM9/10/17
to meetecho-janus
we have done some rtp  record and  rtp to  rtmp,  and i have written some lib to do this. 


hope this help.

在 2017年9月10日星期日 UTC+8下午7:09:43,István Ferenc Tóth写道:

István Ferenc Tóth

unread,
Sep 10, 2017, 7:22:25 AM9/10/17
to meetecho-janus
I forget to mention, I use the videoroom example and I have to handle live video from webrtc.

István Ferenc Tóth

unread,
Sep 10, 2017, 7:22:47 AM9/10/17
to meetecho-janus
Thank you, I'll check it up!

István Ferenc Tóth

unread,
Sep 10, 2017, 9:54:26 AM9/10/17
to meetecho-janus
I successfully step forward with the rtp-forward API request:

var register = { "request" : "rtp_forward", "publisher_id": 458229832363763, "room" : 1234, "audio_port": 5002, "audiopt": 111, "video_port": 5004, "videopt": 100,  "host": "[HOSTSERVERIP]", "secret": "[ADMINPASSWORD]"}
sfutest.send({"message": register});

with sending this I get this:

[gstreamer-sample] New audio stream! (ssrc=3213197696)
[gstreamer-sample] New video stream! (ssrc=1524266694, index 0)

Notice - if you miss the port numbers in the request, it will run without error - but the janus console stay empty.

After this I create a test.spd file with this:

v=0 o=- 0 0 IN IP4 127.0.0.1 s=RTP Video c=IN IP4 127.0.0.1 t=0 0 a=tool:libavformat 56.15.102 m=audio 5002 RTP/AVP 111 a=rtpmap:111 OPUS/48000/2 m=video 5004 RTP/AVP 100 a=rtpmap:100 VP8/90000 a=fmtp:100 packetization-mode=1

If I start the ffmpeg with this:

/usr/bin/ffmpeg -analyzeduration 300M -probesize 300M -protocol_whitelist file,udp,rtp  -i test.sdp  -c:v copy -c:a aac -ar 16k -ac 1 -preset ultrafast -tune zerolatency  -f flv rtmp://[RTMP RECEIVER]

I get this errors:

bind failed: Address already in use
test.sdp: Invalid data found when processing input

Any suggestions?
error

2017. szeptember 10., vasárnap 13:09:43 UTC+2 időpontban István Ferenc Tóth a következőt írta:

István Ferenc Tóth

unread,
Sep 10, 2017, 11:16:27 AM9/10/17
to meetecho-janus
I made a progress, if I choose the existiog ports with the rtp_forward request, then I get the [gstreamer-sample] output, if I choose other, I didn't get anything.

How and where can I check the rtp_forwarding itself was successful?

István Ferenc Tóth

unread,
Sep 10, 2017, 12:14:14 PM9/10/17
to meetecho-janus
Step forward again: Since the ffmpeg setup itself is okay - it's push the stream well if the source is a file, the problem seems to be with the SDP file, or the rtp_forwarding call.

How can I check when the rtp_forwarding work? The gstream is working, other probably not...

Lorenzo Miniero

unread,
Sep 11, 2017, 5:20:26 AM9/11/17
to meetecho-janus
RTP forwarding doesn't care at all if it's gstreamer or ffmpeg that will get the media: it just sends RTP somewhere, where you tell it to. If it works with gstreamer, then RTP forwarding works. If it doesn't with FFmpeg, the problem's there somewhere (e.g. wrong payload types in SDP or something else).

L.

István Ferenc Tóth

unread,
Sep 11, 2017, 5:44:43 AM9/11/17
to meetecho-janus
Thank you Lorenzo

Yes, I assume that, and the gsreamer working well anyway, so it is a problem with ffmpeg. 
My second problem is I change the codec in the videoroom.cfg, and still get the vp8...

Lorenzo Miniero

unread,
Sep 11, 2017, 5:47:56 AM9/11/17
to meetecho-janus
Il giorno lunedì 11 settembre 2017 11:44:43 UTC+2, István Ferenc Tóth ha scritto:
Thank you Lorenzo

Yes, I assume that, and the gsreamer working well anyway, so it is a problem with ffmpeg. 
My second problem is I change the codec in the videoroom.cfg, and still get the vp8...



You have to restart Janus after a change.

L.

István Ferenc Tóth

unread,
Sep 12, 2017, 7:36:30 AM9/12/17
to meetecho-janus
Thank you Lorenzo

I try to change the codec to VP9, now it's displayed well.

As I see from the JSON answer SDP part, the codec is VP9 and ftcp-fb:98, the audio codec is opus, working fine

I make a RTP_forward request, with "video_port": 5008, "videopt":98, "audio_port":5006, "audiopt":111

I make a -sdp file with this parameters:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=RTP Video
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 56.15.102
m=audio 5006 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 5008 RTP/AVP 98
a=rtpmap:98 VP9/90000
a=fmtp:98

Looks like every parameter working well, still the ffmpeg lost the video, and only the audio transmitted well.

Any help really apriciated.

István Ferenc Tóth

unread,
Sep 12, 2017, 9:21:08 AM9/12/17
to meetecho-janus
If It's help to anybody:

I successfully made a test with the same setup and VP8 codec.

Lorenzo Miniero

unread,
Sep 12, 2017, 9:41:39 AM9/12/17
to István Ferenc Tóth, meetecho-janus
Maybe your FFmpeg installation doesn't support VP9, or doesn't have RTP depacketization code for VP9?

L.

--
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-janus+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

István Ferenc Tóth

unread,
Sep 12, 2017, 9:54:08 AM9/12/17
to meetecho-janus
It has a chance, the ffmpeg was builded from the newes sources. Now I'm okay with vp8 anyway, further optimisation in way.

Thank you Lorenzo
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.

Suchira Liyanage

unread,
Sep 12, 2021, 8:55:34 AM9/12/21
to meetecho-janus
How do you resolve that bind failed: Address already in use
test.sdp: Invalid data found when processing input
Error
Reply all
Reply to author
Forward
0 new messages