Sending camera video from browser to server

user1201022 picture user1201022 · Feb 10, 2012 · Viewed 18.8k times · Source

Im trying out the new and exciting features of chrome canary 19.

I can basically grab the video from the web-cam and set it to a source element for a video tag.

<!DOCTYPE html>
<html>
    <head>
    <title>Camera capture</title>
    <script>
        var localStream;
        var localStreamObjUrl;
        window.onload = function() {
            navigator.webkitGetUserMedia("audio, video", gotStream);
        }
        function gotStream(stream) {
            localStream = stream;
            localStreamObjUrl = webkitURL.createObjectURL(localStream);
            var video = document.getElementById("selfView");
            video.src = localStreamObjUrl;
        }
    </script>
</head>
<body>
    <video id="selfView" autoplay audio=muted></video>
</body>
</html>

From the example at https://apprtc.appspot.com, we can grab the video and stream it to a peer...

My question is, can I avoid doing all the traversal to get a p2p connection and directly upload the video to a server? Id like to be able to relay the video stream instead of sending it p2p.

Answer

ethrbunny picture ethrbunny · Jan 13, 2013

You need some kind of streaming media server on the back.

The process would be:

  1. capture the feed
  2. send it to the server
  3. transcode to various client formats
  4. manage the outbound streams

There are numerous free and paid varieties available:

More about transcoding: xuggler
The 'swiss army knife' of media: ffmpeg

and so on.