设备:树莓派3B+、Raspberry Pi Camera
sudo raspi-config #启动camera sudo reboot
#监测摄像头是否安装成功 raspistill -o image.jpg
#安装必要的库 sudo apt-get update sudo apt-get install subversion sudo apt-get install libjpeg8-dev sudo apt-get install imagemagick sudo apt-get install libv4l-dev sudo apt-get install cmake sudo apt-get install git
#git开源的project到本地,编译 sudo git clone https://github.com/jacksonliam/mjpg-streamer.git cd mjpg-streamer/mjpg-streamer-experimental sudo make all sudo make install
#Picamera ./mjpg_streamer -i "./input_raspicam.so" -o "./output_http.so -w ./www" #USBcamera ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www" #查看是否可以观看 #浏览器输入: ip地址:8080
#制作启动脚本 cd 脚本文件夹 sudo nano jk.sh
#输入 ssh -fN -R 服务器端口:localhost:8080 自己的服务器用户名@服务器IP cd ~/mjpg-streamer/mjpg-streamer-experimental ./mjpg_streamer -i "./input_raspicam.so" -o "./output_http.so -w ./www" #-o "output_file.so -f /home/pi/photo -d 3000" #保存,退出
sudo chmod 774 jk.sh
#启动 sh jk.sh