12

The Problem: I need my clients to be able to stream their webcam to my streaming server(for instance Wowza server). I am building my site in PHP. I have gone through various streaming sites like twitch.tv, livestream.com and found that they all use third party broadcasting software like Wirecast, XSplit broadcaster, OBS etc to stream the Webcam feeds to the server. Then I came across sites like vLine, Opentokrtc that uses WebRTC for Video chat.

My Question: So, my question is that, is it possible for me to send the stream to the broadcasting servers like Wowza(So that they can then broadcast my live stream) without using broadcasting softwares with only WebRTC? If Yes, then how? If, No, then what are the other alternatives?

PS. I don't want to use Flash, ActionScript here.

Parthapratim Neog
  • 4,352
  • 6
  • 43
  • 79
  • This is very possible but you may have to modify a broadcasting server. There are plenty of webrtc MCU servers out there that you could utilize as a WebRTC broadcasting server(Broadcaster is P2P to the server, then listeners are P2P to the server for that specific feed). – Benjamin Trent Jul 11 '15 at 14:51
  • you could give kurento media server a try, [Demo docs](http://www.kurento.org/docs/current/tutorials.html#tutorial-3-webrtc-one-to-many-broadcast) [demo code](https://github.com/Kurento/kurento-tutorial-node/tree/release-5.1/kurento-one2many-call) – mido Jul 11 '15 at 16:59

4 Answers4

2

You will basically need a server which has a pseudo WebRTC client integrated in it. WebRTC can get the stream but cannot start streaming until a PeerConnection is setup. You can try using various servers/gateways like Janus, Kurento, Licode, FreeSwitch, etc.

Also MediaStream generate by WebRTC can be directly attached to an HTML5 <video> tag.

Obscure Geek
  • 749
  • 10
  • 22
  • Do you know how we can get the actual bit stream of the video/audio from the MediaStream object. Then I can try to send that bit stream to the server, just a thought though. – Parthapratim Neog Jul 14 '15 at 05:34
  • @ParthapratimNeog I believe direct access to the stream content is not available on the browser client. May be a very long route but something of [this](http://stackoverflow.com/questions/13120591/webrtc-how-to-get-the-webcam-data-as-a-stream-of-data) sort might work out. The images can then be sent to the server and rendered on viewing clients canvas tag. However note that the lag will be considerable in this case. – Obscure Geek Jul 14 '15 at 06:14
2

Using WebRTC for such a use case incurs a high computing cost on the server side and is a rather new technique, which means you should be using it if you know what you are doing.

My suggestion would be to stick to Flash or MPEG-DASH instead - unless what you need must have a very low latency to it and you are fine with paying for it by smaller solution scales.

Tsahi Levent-Levi
  • 2,351
  • 2
  • 18
  • 26
  • 1
    What is the cause of the higher computing costs? A decent MCU would only worry about restamping the control packets and then reencrypting the RTP. Is the cost THAT much higher than Flash(note I have not experience/knowledge about flash, just curious on how it has lower costs)? – Benjamin Trent Jul 13 '15 at 14:03
  • 1
    Isn't Flash going to be deprecated in a few years? Because of this I don't wish to learn ActionScript, which will be a complete waste when Flash becomes completely deprecated. I have been doing some R&D on Kurento and the other servers that @Benjamin and Obscure Geek suggested though. It's really hard to find some good learning materials on WebRTC for a beginner like me. – Parthapratim Neog Jul 14 '15 at 05:39
  • Flash is going the way of the dodo - just a matter of time. For streaming, its main replacement is MPEG-DASH and for iOS HLS. WebRTC isn't designed for streaming though it can be used for it. Its bidirectional nature and the way it adapts to the network are the things that make it unsuitable "as is" for such activities. – Tsahi Levent-Levi Jul 14 '15 at 17:39
1

Unless I misunderstand, I think you're looking to stream video to your server (for distributing using "normal" live-streaming mechanisms), not using WebRTC to stream video from the server.

If so, WebRTC will work, though you'll need a server-side implementation of a fairly full set of the WebRTC protocol including video decoding. These exist, but not in PHP directly of course. This would handle getting realtime audio and video from a client, without needing a plugin on the client, including bandwidth adaptation and error correction.

Once the data is decoded on the server, you have a video+audio datastream you can feed to your live-streaming encoders to stream out.

jesup
  • 6,765
  • 27
  • 32
1

Wowza does support what you need in order to become the other peer in your WebRTC scenario. From there you can redistribute the stream in whatever way media servers typically do.

This feature is still in "Preview" mode and has some limitations, but does function for most cases. You can request access to this via https://www.wowza.com/products/capabilities/webrtc-streaming-software

TomSchober
  • 433
  • 4
  • 12