t-mullen / Web-Broadcasting-Software

Broadcasting software for the web. (WBS)
https://t-mullen.github.io/Web-Broadcasting-Software/
MIT License
141 stars 25 forks source link

how to send to RTMP server ? #1

Closed yarekc closed 7 years ago

yarekc commented 7 years ago

Hello, You say: "You could send it over a WebRTC connection, record it as a file, send to to a proxy RTMP server, pipe it through FFMPEG... anything."

Any idea on how to send that to a RTMP server : I don't think ffmpeg is able to convert webrtc to RTMP

regards

t-mullen commented 7 years ago

You would need to use media-stream-recorder and create a sequence of small webm files. These would need to be sent through an FFMPEG command with the "concat" option.

The webms will be in VP8/VP9 and Opus codecs, so you'll need to transcode those to H.264 and AAC (which is what most streaming services use).

Still trying to get this working myself, but I'm sure it's possible.

The ideal solution would be to write a performant MediaStream-to-RTMP transcoder in WebAssembly that would do all this.

t-mullen commented 7 years ago

Closing because managing the output is out of scope for this project, but feel free to continue discussion here.

t-mullen commented 7 years ago

As for the actual sending of the RTMP packets, client-side Javascript can't access the rtmp:// protocol, so you would need a proxy server for that (which is what I referred to in the README). A modified rtmp-server-nodejs could work.

Overall, it's no easy feat and probably deserving of it's own project altogether.

t-mullen commented 7 years ago

MediaRecorder supports the h264 codec, so that will save you a transcode.

t-mullen commented 7 years ago

Actually it might be better to just use DTLS-SRTP -> Server -> RTMP

The Red5 open media server plans to add this: https://github.com/Red5/red5-server (They moved it into the "pro" version. Unfortunate.)

Another paid service is Wowza, so it is feasible. https://www.wowza.com/blog/using-webrtc-as-a-replacement-for-rtmp