2

How do I extract the video stream in an ongoing webrtc video call and send it to server where it can be transcoded.

As much as I understood about webrtc, its peer to peer. So how do we get the stream to server?

My end goal would be to convert this stream at the server end to rtmp.

A related question was asked on google groups about similar issue, but yet to be answered.

PS: I know a few apps that are already doing the same(e.g. webinarjam ). But not sure how they are doing it.

rahulserver
  • 10,411
  • 24
  • 90
  • 164
  • Duplicated to https://stackoverflow.com/questions/56238148/how-to-use-webrtc-to-stream-video-to-rtmp – Winlin Mar 08 '23 at 10:46

1 Answers1

2
  • you do not have anything at the JS level to achieve this. MediaStream and MediaStream Tracks are opaque objects that you can only manipulate through existing APIs or get / set from sources / to sinks.
  • You can do it if you use a native implementation as the one provided by webrtc.org. By this I mean that you can have access to the raw frames, it is still up to you to re-encode, possibly re-protect (encryption) and re-packet to stream as rtmp.
  • Another, maybe more practical solution is to use an existing media server, either commercial or open source, which supports both webrtc and rtmp and will do everything for you. There are quite a few out there, you have a lot of choice. You will still have to handle the logic portion of your app, and integrate with, say, your signaling server, STUN/TURN, etc ....
  • A final solution that would require the minimum coding, but which comes with minimum flexibility, is to use a PaaS offer which handles both webrtc and rtmp. Here again, there are several choices to pick from, a google search with the right keyword will give you what you need.
Dr. Alex Gouaillard
  • 2,078
  • 14
  • 13