【问题标题】:Transcoding rtsp over http通过 http 转码 rtsp
【发布时间】:2017-04-08 15:16:58
【问题描述】:

在我解释我的问题之前:抱歉英语不好,如果你愿意,你也可以帮助我拼写。

我有一个只提供 RTSP 链接的低成本 IP 摄像机: 192.168.x.x/onvif2 看视频不需要认证...我的路由器没有开放端口^^

我想用 FFMPEG 对 rtsp 进行转码(因为 html 无法播放),以便在服务器 node.js(express)上发送它,并在 index.html 中播放视频标签中的流:

Server.js:

<script>
    var express = require('express');
    var path = require('path');
    var app = express();
    var server = require('http').Server(app);
    var io = require('socket.io')(server);

    app.use(express.static(path.join(__dirname, 'public')));

    app.get('/', function (req, res) {
        res.sendFile(__dirname + '/index.html');
    });

    server.listen(8080);
    console.log("server run at 127.0.0.1:8080");

    io.on('connection',function(socket){
        socket.emit('hello','hello user');
    });
</script>

和 index.html :

<html>
    <video style="background-color: black;" width="480" height="270" autoplay>
    <source src="http://127.0.0.1:8080/vid2.mp4" type="video/mp4" codecs="avc1.42E01E, mp4a.40.2"> 
    </video>

    <script>
        var socket = io.connect();
        socket.on('hello',function(data){
            console.log(data);
        });

    </script>

</html>

ffmpeg -i rtsp://192.168.x.x/onvif2 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -vcodec libx264 -r 25 -b:v 500k -f flv http://127.0.0.1:xx/vid2.mp4

相机启动但我找不到 vid2.mp4

如何将 ffserver 替换为节点服务器(http?udp?...)

【问题讨论】:

    标签: node.js express video ffmpeg stream


    【解决方案1】:

    在流中写入页脚之前,mp4 文件无效。使用像 webm 这样的流式格式

    【讨论】:

      猜你喜欢
      • 2010-09-20
      • 1970-01-01
      • 1970-01-01
      • 2017-11-08
      • 2012-03-14
      • 2017-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多