使用 Node.js 处理 RTSP 以获取图像快照 [英] Process RTSP with Node.js for taking an image snapshot
问题描述
我有一个 RTSP,我很想让 Node.JS 理解它.我找到了一种方法 使用 Java 从网络摄像头中捕获图像 但我很想在这个任务中使用 Node.js 并从视频 RTSP 中获取它.
I have a RTSP that I would love to make Node.JS understand. I found a way to do it using Java taking a capture from a webcam but I would love to just use Node.js on this task and get it from a video RTSP'd.
我的目的是使用 setInterval,获取流,将其转换为 base64 并通过 Socket.IO 将其流式传输到客户端,以便他们可以在浏览器上将其视为 <img>
标记.其中大部分内容来自 使用网络摄像头制作的家伙 但我只有一个 RTSP 可用作视频源.
My intention is to use setInterval, grab the stream, convert it to base64 and stream it through Socket.IO to a client so they can see it as a <img>
tag on their browser. Much of this will be taken from the guy who make it with a webcam but I only have a RTSP available as video-source.
那么,有没有人知道是否有办法做到这一点?
So, does anyone knows if there's a way to do this?
推荐答案
几个月前我真的找到了答案,但忘了我在这里问过.
I really found the answer months ago but forgot I asked here.
我的代码位于 https://github.com/ghostbar/RTSP-Streaming.js.它从 RTSP 流中读取数据并将其转换为 JPEG,然后转换为 base64,以便通过 Socket.IO 将其传递给客户端.
My code is at https://github.com/ghostbar/RTSP-Streaming.js. It reads it from an RTSP stream and converts it to JPEG, then to base64 in order to pass it via Socket.IO to the client.
这篇关于使用 Node.js 处理 RTSP 以获取图像快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!