Hello,
I'm very new to Janus and programming in general, but with all these awesome resources I'm having a blast working with Janus --- thanks!
My goal is to forward RTP data from a user in the the videoroom plugin to the nginx rtmp module and use ffmpeg to convert the RTP data to RTMP or HLS.
Using past forum posts and the API docs, I have managed to accomplish the first part of this and am successfully forwarding RTP data to my server using
this command :
curl -H "Content-Type: application/json" -X POST -d '{"body":{"request":"rtp_forward","publisher_id":
2186766636,"room":1234,"host":"127.0.0.1","audio_port":5000,"video_port":5002,"secret":"adminpwd"},"janus":"message","apisecret" : "janusrocks","transaction":"o4vup0qoomd"}'
The part that is stumping me is the SDP file, which even after a decent amount of research, I still have an admittedly limited understanding of. From forum posts, I gather that the SDP is usually sent at the beginning of a stream so that something like FFMPEG understands what it is receiving; however, the rtp forward feature does not send this so I need to create my own. The one I'm using, janus.sdp, is listed below:
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=video 5002 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100 packetization-mode=1
I have this file stored in the /var/sdp directory that nginx has access to. In the actual nginx-rtmp module, I have the following code that uses this sdp file:
application rtcapp {
live on;
record off;
exec_pull ffmpeg -i /var/sdp/janus.sdp -vcodec libx264 -acodec libmp3lame rtmp://localhost/live;
}
Hopefully I am on the right track and not doing anything egregiously silly. Perhaps this question is more appropriate for a nginx-rtmp or ffmpeg forum, but I have found significantly more posts here that are related to my question. If someone could let me know if I'm on the right track, offer some tips, or direct me to some helpful docs, I would greatly appreciate it.
Again, thanks so much to everyone involved with this project. I have learned so much about WebRTC and network programming just in the last month because of great open source projects like this.