muaz-khan / WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
https://www.webrtc-experiment.com/
MIT License
11.65k stars 3.95k forks source link

Is there a way send a audio-video stream to a media server to broadcast it? #158

Open cyberglot opened 10 years ago

cyberglot commented 10 years ago

Hi.

Your RecordRTC is a good solution that you record audio/video from getUserMedia and then stream it back. But, I want to know if I can make a stream to ffmpeg and then to the media server or make a stream directly to the media server, under a protocol like RTMP, for example.

Thanks.

muaz-khan commented 10 years ago
  1. Demos using ffmpeg-asm.js inside the browser along with RecordRTC
  2. Using Ffmpeg on Nodejs end and POSTing blobs using XHR/JSON/FormData
  3. Using FFmpeg on Nodejs end and pushing blobs using Socket.io

I'm not sure if this demo is correctly encoding from WAV to ogg; then we would be able to make PUT requests to shoutcast/icecast2 server and broadcast over radio stations.

Firefox nightly now supports recording of both audio/video in single webm container; however for soutcast/icecast2, it is already supporting media recording in ogg format since last few months.

cyberglot commented 10 years ago

Will check your demos out, @muaz-khan. Really thanks. :)

cyberglot commented 10 years ago

But, how long do you think this thing could stream the audio/video to ffmpeg/node.js? I tested it and the video stops at 30segs in the playback.

Edit: Could I start streaming back without a need of stopping it?

muaz-khan commented 10 years ago

To record video frames on chrome, RecordRTC is relying totally on whammy.js which encodes webp images in webm container using kind of very slow encoder; and the original encoding process takes too much time.

Whammy.js' single cluster ends after each 30 seconds; retrying new cluster is causing issue for 2nd cluster; however, it seems that 3rd and upcoming are working fine.

If you're using Firefox; you can use MediaStreamRecorder.js to get non-stopped ogg blobs after your specified interval. Though, MediaStreamRecorder's current implementation is buggy.