Skip to content

Commit

Permalink
🎉auto update by Gmeek action
Browse files Browse the repository at this point in the history
  • Loading branch information
Meekdai committed Sep 26, 2023
1 parent 85a96ca commit a0c2763
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 14 deletions.
60 changes: 60 additions & 0 deletions backup/树莓派mjpg-streamer启动多个USB摄像头.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
MJPG-streamer是一个优秀的开源项目,它可以通过HTTP的方式访问linux上面的兼容摄像头,从而做到远程视频传输的效果。本文主要记录树莓派4B配置的过程。

我使用的树莓派是4B 2G内存版本,运行的是`Raspberry Pi OS Lite(32-bit) 2023-05-03`版本的系统。

启动树莓派后,插入USB摄像头,可以通过`lsusb``ls /dev/video*` 查看USB摄像头有没有被正确挂载。

### 安装库
然后是下面必须要安装的库,特别注意`libjpeg9-dev`,网上的一些教程都是安装`libjpeg8-dev`

```
sudo apt-get update
sudo apt-get install subversion
sudo apt-get install libjpeg9-dev
sudo apt-get install imagemagick
sudo apt-get install libv4l-dev
sudo apt-get install cmake
```

### 克隆编译

```
sudo git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make all
sudo make install
```
如果由于网络问题无法克隆的,可以直接下载`zip`包,然后解压安装
```
unzip mjpg-streamer-master.zip
cd mjpg-streamer/mjpg-streamer-experimental
make all
sudo make install
```

### 运行

如下指令中`/dev/video0`是对应的摄像头,`8080`是网页访问的端口号
```
mjpg_streamer -i "input_uvc.so -d /dev/video0 -n -f 10 -r 1280x720" -o "output_http.so -p 8080 -w www"
```
然后在浏览器中访问`http://[树莓派ip]:8080`就可以看到摄像头的画面了,里面还有一些配置就不多展开了。

### 配置多摄像头
```
mjpg_streamer -i "input_uvc.so -d /dev/video0 -n -f 10 -r 1280x720" -o "output_http.so -p 8080 -w www" & mjpg_streamer -i "input_uvc.so -d /dev/video2 -n -f 10 -r 1280x720" -o "output_http.so -p 8082 -w www"
```
如此,访问`8080`端口和`8082`端口就是两个不同的摄像头了,增加多个摄像头同理。

### 其他

***fswebcam***
通过安装`sudo apt-get install fswebcam`,然后`fswebcam --no-banner -r 640*480 camera.jpg` 可以在`/home/pi`目录下生成一个当前摄像头拍摄到的实时照片。以此证明USB摄像头工作正常。

***motion***
可参考:https://bun.plus/posts/monitoring-with-raspberry-pi-and-motion

***restreamer***
可参考:https://docs.datarhei.com/restreamer/getting-started/quick-start

试用`motion``restreamer`都出现视频卡顿的问题,不知道是不是我没有配置对,但是`MJPG-streamer`是真的开箱即用,很方便。
2 changes: 1 addition & 1 deletion blogBase.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ <h1>
<span class="Label" style="background-color:#D93F0B">软件</span>
<span class="Label" style="background-color:#A333D0">2023-07-11</span>
</div>
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/shu-mei-pai-mjpg-streamer-qi-dong-duo-ge-USB-she-xiang-tou.html">
<div class="d-flex flex-items-center">
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
</svg>
<span>树莓派mjpg-streamer启动多个USB摄像头</span>
</div>
<div class="listLabels">

<span class="Label" style="background-color:#D93F0B">软件</span>
<span class="Label" style="background-color:#A333D0">2023-09-26</span>
</div>
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/ESP32-C3%20-gu-jian-xia-zai-xiao-gong-ju.html">
<div class="d-flex flex-items-center">
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
Expand Down Expand Up @@ -254,17 +265,6 @@ <h1>
<span class="Label" style="background-color:#0E8A16">硬件</span>
<span class="Label" style="background-color:#1f883d">2018-11-21</span>
</div>
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/yang-yu-%EF%BC%9F-wo-ying-gai-bu-xing.html">
<div class="d-flex flex-items-center">
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
</svg>
<span>养鱼?我应该不行</span>
</div>
<div class="listLabels">

<span class="Label" style="background-color:#4F61FC">日常</span>
<span class="Label" style="background-color:#1f883d">2018-04-16</span>
</div>
</a>
</nav><nav class="paginate-container" aria-label="Pagination">
<div class="pagination"><span class="previous_page" aria-disabled="true">上一页</span>
Expand Down
13 changes: 12 additions & 1 deletion docs/page2.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ <h1>
<div id="content">
<div style="margin-bottom: 16px;">童话是一种生活态度,仅此而已。</div>
<nav class="SideNav border">
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/ni-shi-fou-huan-zai-shi-yong-PPT.html">
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/yang-yu-%EF%BC%9F-wo-ying-gai-bu-xing.html">
<div class="d-flex flex-items-center">
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
</svg>
<span>养鱼?我应该不行</span>
</div>
<div class="listLabels">

<span class="Label" style="background-color:#4F61FC">日常</span>
<span class="Label" style="background-color:#1f883d">2018-04-16</span>
</div>
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/ni-shi-fou-huan-zai-shi-yong-PPT.html">
<div class="d-flex flex-items-center">
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
</svg>
Expand Down
Loading

0 comments on commit a0c2763

Please sign in to comment.