我希望能够在网上查看CCTV屏幕

问题描述 投票:0回答:1

我希望能够在网上查看CCTV屏幕。

我一直致力于一个允许在网络上查看ip camera的项目。然后我被要求在网上看到同轴相机。所以我决定使用DVR。首先,我将DVR连接到路由器。然后DVR接收同轴摄像机的输入,DVR通过路由器发送信息。通过这个过程,我确认rtsp正常工作。但它在网络上无效。

我目前正在使用nginx Web服务器。并使用ffmpeg将rtsp信息发送到我的nginx Web服务器上的rtmp。然后,Web服务器将其转换为hls(index.m3u8)文件。我觉得在这个过程中出了点问题。

Nginx RTMP配置

# RTMP Config
rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 4000;
        application live{
            live on;
            deny play all;
            push rtmp://localhost/play;
            on_publish http://localhost:3001/api/on-live-auth;
            on_publish_done http://localhost:3001/api/on-live-done;
        }
        application play {
            live on;
            # Turn on HLS
            hls on;
            hls_nested on;
            hls_fragment_naming system;
            hls_path /home/banana/nginx/live;
            hls_fragment 3;
            hls_playlist_length 60;

            # disable consuming the stream from nginx as rtmp
            #deny play all;
        }
    }
}
# End RTMP Config

FFMPEG命令

ffmpeg -i rtsp://<cameraIp> -c:v copy -rtsp_transport tcp -preset veryfast -c:a copy -fflags +igndts+genpts -f flv rtmp://localhost/live/<cameraId>

检测结果

IP Camera RTSP地址= admin:qwerty1。@ ssnet4.iptime.org:555 / trackID = 3

DVR RTSP地址= admin:[email protected]:4524/1

分别在vlc播放器中运行上述rtsp地址

成功:IP Camera RTSP地址,DVR RTSP地址

IP摄像机HLS地址= http://168.131.150.80:4567/live/5c28ae28c6cd0c6c329e1ebc/index.m3u8

DVR HLS地址= http://168.131.150.80:4567/live/5c8746c9d7d74a600edf2460/index.m3u8

分别在vlc播放器中运行上述rtsp地址

成功:IP Camera HLS地址

失败:DVR HLS地址

这与反应玩家的结果相同。

const streamUrl = `http://168.131.150.80:4567/live/<cameraId>/index.m3u8`;
<ReactPlayer
            onClick={this._onClickFullscreen}
            width={"100%"}
            height={"100%"}
            url={streamUrl}
            playing={true}
            controls={false}
            muted={true}
          />

  1. 有没有办法直接在网上看到rtsp?
  2. 问题是什么,另一种方式是什么?
javascript reactjs nginx ffmpeg hls
1个回答
1
投票

没有。没有安装插件的原因没有为什么在Web浏览器中看到RTSP。

Web浏览器支持的唯一协议是http,websocket和webrtc。

© www.soinside.com 2019 - 2024. All rights reserved.