javascript 使用 Node.js 处理 RTSP 以获取图像快照
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8289421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Process RTSP with Node.js for taking an image snapshot
提问by ghostbar
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 webcambut I would love to just use Node.js on this task and get it from a video RTSP'd.
我有一个 RTSP,我很想让 Node.JS 理解它。我找到了一种使用 Java 从网络摄像头进行捕获的方法,但我很想在此任务中使用 Node.js 并从视频 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 webcambut I only have a RTSP available as video-source.
我的目的是使用 setInterval,获取流,将其转换为 base64 并通过 Socket.IO 将其流式传输到客户端,以便他们可以将其视为<img>
浏览器上的标记。其中大部分内容都来自使用网络摄像头制作它的人,但我只有一个 RTSP 作为视频源可用。
So, does anyone knows if there's a way to do this?
那么,有谁知道是否有办法做到这一点?
采纳答案by ghostbar
I really found the answer months ago but forgot I asked here.
几个月前我真的找到了答案,但忘了我在这里问过。
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.
我的代码位于https://github.com/ghostbar/RTSP-Streaming.js。它从 RTSP 流中读取数据并将其转换为 JPEG,然后转换为 base64,以便通过 Socket.IO 将其传递给客户端。
回答by user508994
Here's some code with minimal dependencies which can read data from a Webcam and upload it to as an image on the server using Node: https://github.com/josher19/node-jpegcam
这是一些具有最小依赖性的代码,它们可以从网络摄像头读取数据并将其作为图像上传到使用 Node 的服务器上:https: //github.com/josher19/node-jpegcam
You could have it send the data to the client instead of saving it as an image on the server.
您可以让它将数据发送到客户端,而不是将其保存为服务器上的图像。
->> Josh <<-
->>乔希<<-