使用带有 webRTC 的 IP 摄像头 [英] Use an IP-camera with webRTC

查看:74
本文介绍了使用带有 webRTC 的 IP 摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 webrtc 中使用 IP 摄像头.但是 webrtc 似乎只支持网络摄像头.所以我尝试将 IP 摄像头的流转换为虚拟网络摄像头.

I want to use an IP camera with webrtc. However webrtc seems to support only webcams. So I try to convert the IP camera's stream to a virtual webcam.

我找到了 IP 摄像机适配器 之类的软件,但它们不能很好地工作 (2-3每秒帧数和 2 秒延迟)并且它们仅适用于 Windows,我更喜欢使用 Linux(如果可能的话).

I found software like IP Camera Adapter, but they don't work well (2-3 frames per second and delay of 2 seconds) and they work only on Windows, I prefer use Linux (if possible).

我尝试 ffmpeg/avconv:

I try ffmpeg/avconv:

  • 首先,我使用 v4l2loopback 创建了一个虚拟设备(命令是:sudo modprobe v4l2loopback).检测到虚拟设备,可以使用如下命令提供视频 (.avi):ffmpeg -re -i testsrc.avi -f v4l2/dev/video1

  • firstly, I created a virtual device with v4l2loopback (the command was: sudo modprobe v4l2loopback). The virtual device is detected and can be feed with a video (.avi) with a command like: ffmpeg -re -i testsrc.avi -f v4l2 /dev/video1

来自 IP 摄像机的流可通过:rtsp://IP/play2.sdp 用于 Dlink DCS-5222L 摄像机.这个流可以被 ffmpeg 捕获.

the stream from the IP camera is available with: rtsp://IP/play2.sdp for a Dlink DCS-5222L camera. This stream can be captured by ffmpeg.

我的问题是在这两个步骤之间建立链接(接收 rstp 流并将其写入虚拟网络摄像头).我尝试了 ffmpeg -re -i rtsp://192.168.1.16/play2.sdp -f video4linux2 -input_format mjpeg -i/dev/video0 但是 v4l2 出现错误(找不到 v4l2).

My problem is to make the link between these two steps (receive the rstp stream and write it to the virtual webcam). I tried ffmpeg -re -i rtsp://192.168.1.16/play2.sdp -f video4linux2 -input_format mjpeg -i /dev/video0 but there is an error with v4l2 (v4l2 not found).

有谁知道如何在 webRTC 中使用 IP 摄像头?

Does anyones has an idea how to use an IP camera with webRTC?

推荐答案

简短的回答是,不.RTSP 在 WebRTC 的 IETF 标准中没有提及,目前没有浏览器计划支持它.Chrome 讨论链接.

Short answer is, no. RTSP is not mentioned in the IETF standard for WebRTC and no browser currently has plans to support it. Link to Chrome discussion.

更长的答案是,如果你真的对这个想法售罄,你将不得不使用原生 WebRTC API.

Longer answer is that if you are truly sold out on this idea, you will have to build a webrtc gateway/breaker utilizing the native WebRTC API.

  1. 在浏览器和断路器之间启动 WebRTC 会话
  2. 使用网关/断路器获取 IP 摄像机源
  3. 加密 rtp 流并将其从断路器通过 WebRTC API 收集的 RTSP 流推送到您的 WebRTC 会话.

这就是其他人是如何做到的以及必须如何做到的.

This is how others have done it and how it will have to be done.

2014 年 7 月 30 日更新:

UPDATE 7/30/2014:

我已经对 janus-gateway 进行了试验,我相信流媒体插件完全可以做到这一点,因为它可以获取 rtp流并将其推送到 webrtc 对等点.对于 RTSP,您可能可以创建 RTSP 客户端(可能使用 gstreamer 之类的库),然后将 RTP 和 RTCP 从连接推送到 WebRTC 对等方.

I have experimented with the janus-gateway and I believe the streaming plugin does EXACTLY this as it can grab an rtp stream and push it to an webrtc peer. For RTSP, you could probably create RTSP client(possibly using a library like gstreamer), then push the RTP and RTCP from the connection to the WebRTC peer.

这篇关于使用带有 webRTC 的 IP 摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆