2023年8月29日 星期二

Stream Video - Raspberry Pi + USB Webcam

Purpose:

This project uses Raspberry Pi and usb webcam to do video stream. We need to create a MJPG Stream Server to be able to live stream with Raspberry Pi. This can be connected to multiple usb cameras and used as a monitoring system. 

Fundamental:

MJPG Streamer

mjpg-streamer is a command line application that copies JPEG frames from one or more input plugins to multiple output plugins. It can be used to stream JPEG files over an IP-based network from a webcam to various types of viewers such as Chrome, Firefox, Cambozola, VLC, mplayer, and other software capable of receiving MJPG streams.


Installing the mjpg-streamer on Raspberry Pi:

1. sudo apt-get update
2. sudo apt-get install libjpeg8-dev
3. sudo apt-get install imagemagick 
4. sudo apt-get install libv4l-dev
5. sudo apt-get install libjpeg-dev
6. sudo apt-get install cmake
7. Download wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip
8. unzip master.zip
9. cd mjpg-streamer
10. cd mjpg-streamer-experimental
11. make clean all
12. sudo make install 

Execute the mjpg-streamer on Raspberry Pi:
1. ls -al /dev/ |grep video  -- check if your webcam is supported on Raspberry Pi 
2. v4l2-ctl --list-devices      -- List devices for v4l2 interface
3. ./mjpg_streamer -i "/usr/local/lib/mjpg-streamer/input_uvc.so -y -d /dev/video0 -n -f 6 -r 640x480" -o "/usr/local/lib/mjpg-streamer/output_http.so -p 8084 -w /usr/local/share/mjpg-streamer/www"
4. ./mjpg_streamer -i "/usr/local/lib/mjpg-streamer/input_uvc.so -y -d /dev/video2 -n -f 6 -r 640x480" -o "/usr/local/lib/mjpg-streamer/output_http.so -p 8085 -w /usr/local/share/mjpg-streamer/www"

YouTube Demonstration:









沒有留言:

張貼留言