Search code examples
video-streamingstreamingwebcamlive-streaming

Streaming Live Webcams


Building a website where members can stream their webcams to my server so that other members can view the live feeds that are currently streaming.

Sort of like: http://chatroulette.com

How do I take a member's webcam, push the feed to the server, and then allow others to view the feeds in real-time?

The website is web-based, written in PHP with a MySQL database - but I'm willing to add Javascript, jQuery, Flash, or whatever is needed to make this work.

I know this is broad but really need some guidance here!


Solution

  • You have to solve 3 three problems.

    1. Stream your member’s webcam to your server. I would start with RTSP/RTP as protocol and do H.264/AAC for compression of the AV streams. You need a software that compresses the WEB cam’s output – start with ffmpeg (build it with x264 and libfaac included) and live555 (http://www.live555.com/liveMedia/) for the RTSP/RTP server. You could also try using libVLC that will give you RTSP/RTP stream with compression based. For a prototype you can use the VLC player and have it stream the web cam for you: http://geraldnaveen.blogspot.com/2009/04/streaming-webcam-using-vlc.html

    2. Your server has to receive the RTSP/RTP streams I would use live555 again but now you have to receive RTP – hence you have to use the RTSP client. You can prototype with http://www.live555.com/openRTSP/ and testRTSPClient is a good starting point.

    3. Now your server has to re-stream the various webcams in a format that browsers understand – ideally without a plug-in or flash. I’d try HTTP live streaming. Check http://www.longtailvideo.com/html5/hls/. Ultimately your server has to “transmux” the incoming streams to MP4 or HLS and may be transcode to WeM for Chrome.