外网访问内网摄像头
-
在github上下载nginx和ffmpeg软件;
ffmpeg:https://www.gyan.dev/ffmpeg/builds/
下载ffmepeg-release-essentials.zip -
开启nginx服务器,然后在设置ffmpeg环境变量
检测ffmpeg是否设置成功:cmd,然后ffmpeg -version

-
cmd,命令行进入ffmpeg文件下bin文件夹下,输入
fmpeg -re -stream_loop -1 -rtsp_transport tcp -i "rtsp://账号:密码@内网ip:端口/h264/ch1/main/av_stream" -f mp4 -c copy -flvflags no_duration_filesize -f flv "rtmp://公网IP:1935/live/four需要修改的5个地方
- 账号:一般默认admin
- 密码
- 内网ip
- 端口:默认554
- 公网ip
-
授权失败(海康摄像机)
报错:
method DESCRIBE failed: 401 Unauthorized.
rtsp://xxxxxx:Server returned 401 Unauthorized (authorization failed)
内网ip不对,到海康官网下载网络设备搜索软件。里面可以显示所有摄像头ip地址。替换后再执行上面代码。
报错:
Connection to tcp://xxxx:1935?tcp_nodelay=0 failed:Error number -138 occurred
cannot open connection tcp://xxxxx:1935?tcp_nodelay=0 rtmp://xxxxx:1935/live/: Error number -138 occurred
公网ip所在电脑没有打开1935端口。
去打开1935端口:https://blog.csdn.net/qq_31813549/article/details/102823308
如果出现“elnet不是内部或外部命令”,则去https://blog.csdn.net/qq_36292543/article/details/119645130。
shift,1935端口一直无法打开。所以扑街。
- 最后还是使用了在内网进行调用。

浙公网安备 33010602011771号