Sending camera video from browser to server

2019-02-01 23:35发布

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.

4条回答
来,给爷笑一个
2楼-- · 2019-02-01 23:48

I have developed video recording solutions for the better part of the last 5 years and contributed a lot to fixing video recording bugs in Red5.

On the desktop you can use a Flash client + a media server (Red5, Wowza, Adobe Media Server) and on the mobile you can use HTML Media Capture.

I gave a detailed answer on a similar question at Record video on browser and upload to LAMP server

查看更多
劫难
3楼-- · 2019-02-01 23:50

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.

查看更多
Juvenile、少年°
4楼-- · 2019-02-01 23:50

Wow, the question is almost two years old and still relevant. Currently the two options you have is either feeding the camera stream to a canvas in order to regularly send screenshots to your sever (easy but very slow), or using WEBRTC to stream the data. Unfortunately, support for WEBRTC on the server side is still not very good as there are not too many webrtc libraries for common programming languages.

查看更多
干净又极端
5楼-- · 2019-02-01 23:51

You can try nimbb, in which they have Flash-based and HTML5 capturing. After that, you can push the video to Brightcove to transcode it to various clients format.

They have API integration. The only issue is the cost.

查看更多
登录 后发表回答