树莓派-实时视频监控

                                      树莓派-实时视频监控

     这是利用Dominic Szablewski出色的JSMPEG项目,将Pi的相机模块低延迟流式传输到任何合理的现代网络浏览器的 演示。其他依赖项是Python ws4py,我的picamera(特别是1.7或更高版本)和FFmpeg

方法一:

安装

首先确保你有一个功能正常的Pi相机模块(测试它 raspistill是确定的)。然后确保安装了以下软件包:

$ sudo apt-get install ffmpeg git python3-picamera python3-ws4py

接下来,克隆此存储库:

$ git clone https://github.com/waveform80/pistreaming.git

用法

运行Python服务器脚本,该脚本应在启动时将大量内容打印到控制台:

$ cd pistreaming

$ python3 server.py

Initializing websockets server on port 8084

Initializing HTTP server on port 8082

Initializing camera

Initializing broadcast thread

Spawning background conversion process

Starting websockets thread

Starting HTTP server thread

Starting broadcast thread

现在启动您最喜欢的网络浏览器并访问该地址 http://pi-address:8082/- 它应该很快开始显示来自摄像头的提要。您应该能够同时访问来自多个浏览器的URL(尽管显然您迟早会使Pi的带宽饱和)。

如果您发现视频口吃或延迟特别糟糕(超过一秒钟),请检查Pi与客户端之间是否有良好的网络连接。我发现以太网工作得很好(即使中间有电力线盒等)但是一个糟糕的wifi连接不能提供足够的带宽,丢弃的数据包处理得不是很好。

要关闭服务器,请按Ctrl + C - 您可能会发现关闭它需要一段时间,除非您关闭客户端Web浏览器(Chrome特别倾向于保持连接打开,这将阻止服务器关闭,直到套接字关闭)。

 

方法2:

先安装相关软件


$ sudo apt-get install libav-tools git python-setuptools python-pip python-picamera
$ sudo pip install ws4py

下载代码

git clone https://github.com/waveform80/pistreaming.git

 

使用方法

$ cd pistreaming
$ python server.py
Initializing websockets server on port 8084
Initializing HTTP server on port 8082
Initializing camera
Initializing broadcast thread
Spawning background conversion process
Starting websockets thread
Starting HTTP server thread
Starting broadcast thread

 

非常流畅,几乎感觉不到延时,另外手机上也可以通过浏览器查看了。
 

你可能感兴趣的:(树莓派)