简体   繁体   English

FFMPEG 远程 IP 摄像头通过 RTSP h.264 格式到 HLS Localhost m3u8 格式

[英]FFMPEG remote IP camera over RTSP h.264 format to HLS Localhost m3u8 format

I'm trying to convert the remote IP camera over RTSP to a localhost HLS format so that I can display it in a UI.我正在尝试通过 RTSP 将远程 IP 相机转换为本地 HLS 格式,以便我可以在 UI 中显示它。 I'm using a java library that only supports HLS over HTTP not remote IP camera.我正在使用一个 java 库,它仅支持通过 HTTP 而非远程 IP 相机的 HLS。

I'm under the impression FFMPEG can do this because I can write the HLS file just fine directly to my disc but when I change the target to something like http://localhost:8080/stream.m3u8 it cannot seem to connect to localhost.我的印象是 FFMPEG 可以这样做,因为我可以将 HLS 文件直接写入我的光盘,但是当我将目标更改为http://localhost:8080/stream.m3u8之类的东西时,它似乎无法连接到 localhost .

Below is my attempted FFMPEG command (IP/User/Pass left off) but I know that it can at least connect and read the RTSP camera fine.下面是我尝试的 FFMPEG 命令(IP/用户/密码关闭),但我知道它至少可以很好地连接和读取 RTSP 摄像机。

ffmpeg -i rtsp://[Username]:[Password]@[IP]/axis-media/media.amp?videocodec=h264 -rtsp_transport ffplay http://localhost:8080/media.m3u8

The error I'm getting back is Connection to tcp://localhost:8080 failed: Error number -138 occurred我回来的错误是 Connection to tcp://localhost:8080 failed: Error number -138 occurred

I thought that ffmpeg could handle hosting the file on localhost itself.我认为 ffmpeg 可以处理在 localhost 本身上托管文件。 FFServer is deprecated and removed but according to documentation it can still kick up a server just fine FFServer 已被弃用并删除,但根据文档,它仍然可以很好地启动服务器

https://ffmpeg.org/index.html#ffserv https://ffmpeg.org/index.html#ffserv

Solution in this case was to move on from the HLS format and take advantage of node libraries that do RTSP streaming.在这种情况下,解决方案是从 HLS 格式继续前进,并利用执行 RTSP 流的节点库。 There are many, in the end I used node-rtsp-stream.有很多,最后我用的是node-rtsp-stream。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM