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

问题描述

我想将IP摄像机与webrtc一起使用.但是,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 创建了一个虚拟设备(命令为:).检测到该虚拟设备,并可以使用以下命令将视频(.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?

推荐答案

简短的答案是,不是. WebRTC的IETF标准中未提及RTSP,并且当前没有浏览器计划支持它. 链接到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.

更长的答案是,如果您真的被这个想法所抢购一空,则必须使用本机.

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 Camera feed
  3. 将破坏者通过WebRTC API收集的RTSP流中的rtp流加密并推送到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客户端(可能使用),然后将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.

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

07-23 02:15