galactocalypse
galactocalypse

Reputation: 1935

Streaming webcam and mic inputs through browser

Short version:
I need an in-browser solution to deliver the webcam and mic streams to a server.

Long version:
I'm trying to create a live streaming application. So far I've only managed to figure out this workflow:

  1. Client creates stream (some transcoder is probably required here)
  2. Client sends(publishes?) stream to server (basically hosts an RTMP/other stream that should be accessible by my server)
  3. Server transcodes, transrates, etc. and publishes the stream to a CDN
  4. Viewers watch published stream

Ideally, I'd like a browser-based solution that requires minimal setup from the client's end (a Flash plugin download might be acceptable) and streams the webcam and mic inputs to the server. I'm either unaware of the precise keywords or am looking for the wrong thing, but I can't find an apt solution.

Solutions that involve using ffmpeg or vlc to publish a stream aren't really what I'm looking for, since they require additional download and setup, and aren't restricted to just webcam and mic inputs. WebRTC probably won't serve the same quality but if all else fails, I think it can get the job done, at least for some browsers.

I'm using Ubuntu for development and have just activated a trial license for Wowza streaming server and cloud.

Is ffmpeg/vlc et. al. the only way out? Or is there something that can do the job in a single browser tab?

Upvotes: 0

Views: 2954

Answers (1)

aergistal
aergistal

Reputation: 31229

If you go the RTMP way, Adobe Flash Player supports H.264 encoding directly. Since you mentioned Wowza you can find an example and complete source code (including the fla) in the examples directory. There's also a demo here. There are many other open-source Flash capture plugins.

You can also use the aforementioned Flash recorder without Wowza. In this case you'll need a RTMP server, a notable example being the Nginx RTMP module which supports recording (to flv) and also offers callbacks that allow you to launch the transcoding once the recording is done.

With WebRTC you can record (getUserMedia, MediaStreamRecorder) small media chunks and send them to the server where they will get concatenated or using the peer-to-peer communications features of WebRTC (RTCPeerConnection). For a detailed overview see my answer here.

In both cases you'll have issues with devices/browsers that don't support Flash or WebRTC, eg. iPhones, Safari. Plus getUserMedia doesn't capture the same format across all browsers: Firefox audio/video in WebM and Chrome audio in wav and video in WebM.

For mobile devices you'll probably have to write apps.

Upvotes: 1

Related Questions