dpnof28482 2015-11-20 13:58
浏览 559

将实时网络摄像头源编码为RTMP编码视频

I am working on a concept where people can go live using their webcam. So basically it's a web app. I am using webRTC concept. My code is pretty basic but still have a look :

<script>
(function () {
    console.log('here');
    navigator.getMedia = navigator.getUserMedia ||
            navigator.webkitGetUserMedia ||
            navigator.mozGetUserMedia ||
            navigator.msGetUserMedia;
    window.hasUserMedia = function hasUserMedia() {
        return navigator.getMedia ? true : false;
    };
    var errorcallback = function (e) {
        console.log('errorCalback: ' + e);
    };
    navigator.getMedia({
        video: true,
        audio: true
    },
    function (stream) {
        var video = document.getElementById('live'),
                webcamstream, streamrecorder,
                vendorUrl = window.URL || window.webkitURL;
        console.log(video);
        video.src = vendorUrl.createObjectURL(stream);
        //webcamstream = stream;
        //video.play();
        video.onloadedmetadata = function (e) {
            var counter = 0;
            counter++;
            console.log(e);
            console.log(video.src);
        };
    }, errorcallback);
})();

This video.src gives a source but i think it's in blob format.

the output is something like mediastream:http://localhost.movyt.com/8b57e486-a985-4331-b9ab-0eaf6def3404. Well blob formats can't be published. We need to encode it to RTMP encoded. My question is how would i encode it with out any third party softwares because as a end user i will not likely install any software for signing up a website.

I tried with flash for live streaming but there is a need to install flash live encoder which i don't want to use as it won't be user friendly. There are pretty dedicated servers like wowza, dacast and all but they need RTMP encoded video streams for further processing .

note: I tried with a <video src=video.src> in another page but it won't fruit into any result because as per the previous code written video.src is coming from video metadata.

So is there any way to encode my blob video to RTMP protocol?

  • 写回答

1条回答 默认 最新

  • duanke2503 2017-12-17 14:45
    关注

    Since you have already looked at Wowza I assume you are going to be redistributing this published stream. That server does have WebRTC capabilities:

    https://www.wowza.com/products/capabilities/webrtc-streaming-software

    You currently have to sign up for the "Preview" to activate these features, but not for much longer.

    I highly recommend avoiding the attempt at using RTMP as a transport protocol to/from the browser, as this will always require a plugin like Flash (on its way out).

    评论

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?