在樹莓派(Raspberry Pi 3 B)上安裝串流影像 mjpg-streamer

硬件:
樹莓派Raspberry Pi 3b (Stretch / Jessie)
USB 攝像頭 (Logitech C525)
PI NOIR CAMERA V2

安裝步驟

1) 更新系統
sudo apt-get update
sudo apt-get upgrade
2) 啓用攝像頭設置
sudo raspi-config
選擇Interfacing Options -> enable Camera
之後重啓

3) 使用git下載 mjpg-streamer https://github.com/jacksonliam/mjpg-streamer
sudo apt-get install git
git clone https://github.com/jacksonliam/mjpg-streamer.git

4) 安裝mjpg-streamer外部使用的Library

sudo apt-get install libjpeg8-dev imagemagick libv4l-dev cmake 
改變符號鏈接
ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
5)  安裝mjpg-streamer
cd mjpg-streamer
cd mjpg-streamer-experimental
make
sudo make install
5) 安裝攝像頭驅動程序 (一般攝像頭和PI NOIR CAMERA V2)
- (如果使用Stretch)
curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add
sudo nano /etc/apt/sources.list
添加以下至 /etc/apt/sources.list
deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main

- (如果使用Jessie)

curl http://www.linux-projects.org/listing/uv4l_repo/lrkey.asc | sudo apt-key add -
sudo nano /etc/apt/sources.list
添加以下至 /etc/apt/sources.list
deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/ jessie main

之後安裝驅動程序

sudo apt-get update
sudo apt-get install uv4l uv4l-raspicam
sudo apt-get install uv4l-raspicam-extras
6) 啓動mjpg-streamer服務器

export LD_LIBRARY_PATH=.
- 對於普通的USB攝像頭
./mjpg_streamer -o "output_http.so -w ./www" -i "input_uvc.so"
- pi 串行攝像頭 (serial)
./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"

7) 登錄到服務器
在網絡瀏覽器中打開 http://localhost:8080 or http://<your-ip>:8080

如下: 





額外 1) 如果你想製作一個html頁面來包含視頻流, 如下: 

<html>
  <head>
    <title>MJPG-Streamer - Stream Example</title>
  </head>
  <body>
    <center>
      <img src="http://192.168.1.15:8080?action=stream" /> 
    </center>
  </body>
</html>


額外 2) pi串行攝像頭安裝





相關的網頁鏈接:

https://github.com/jacksonliam/mjpg-streamer

http://www.linux-projects.org/uv4l/installation/


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章