All Projects → kraten → webcam-to-cctv-using-rpi

kraten / webcam-to-cctv-using-rpi

Licence: other
In this project, we will use a webcam with Raspberry Pi to live stream wirelessly.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to webcam-to-cctv-using-rpi

Pi Camera In A Box
Stream your Raspberry Pi Camera Module directly to your web browser
Stars: ✭ 49 (+188.24%)
Mutual labels:  cctv, raspberry-pi-camera, raspberry-pi-3
Rpisurv
Raspberry Pi surveillance
Stars: ✭ 293 (+1623.53%)
Mutual labels:  surveillance, raspberry-pi-camera, raspberry-pi-3
Face-Recognition-using-Raspberry-Pi
A small project which does face detection using OpenCV library.
Stars: ✭ 48 (+182.35%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
book-ml
書籍「今すぐ試したい!機械学習・深層学習(ディープラーニング)画像認識プログラミングレシピ」のソースコードを配布するレポジトリです。
Stars: ✭ 29 (+70.59%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
Homekitcam
A project to make a Raspberry Pi driven, HomeKit Enabled camera.
Stars: ✭ 69 (+305.88%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
Object-sorting-using-Robotic-arm-and-Image-processing
Sorting objects of different colors using robotic arm and using computer vision (image processing).
Stars: ✭ 21 (+23.53%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
azure-iot-starter-kits
Samples for Azure IoT starter kits.
Stars: ✭ 29 (+70.59%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
Fotobox
Python based photo-booth script for Raspberry Pi and RPi Camera
Stars: ✭ 22 (+29.41%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
Human-detection-system-with-raspberry-Pi
A motion detection system with RaspberryPi, OpenCV, Python
Stars: ✭ 50 (+194.12%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
Live-Streaming-using-OpenCV-Flask
A Flask Web-App to stream live from local webcam or CCTV (rtsp link)
Stars: ✭ 144 (+747.06%)
Mutual labels:  cctv, webcam
Cyber Camera
Turns any webcam into a smart security camera for home surveillance
Stars: ✭ 68 (+300%)
Mutual labels:  surveillance, webcam
jeelizPupillometry
Real-time pupillometry in the web browser using a 4K webcam video feed processed by this WebGL/Javascript library. 2 demo experiments are included.
Stars: ✭ 78 (+358.82%)
Mutual labels:  cctv, webcam
Raspberryio
The Raspberry Pi's IO Functionality in an easy-to-use API for Mono/.NET/C#
Stars: ✭ 593 (+3388.24%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
Security Camera
🔦 Motion detecting security camera using a raspberry pi, webcam, and slack
Stars: ✭ 76 (+347.06%)
Mutual labels:  cctv, webcam
PiHueEntertainment
An application that can handle the Hue Entertainment Areas on a Raspberry Pi
Stars: ✭ 28 (+64.71%)
Mutual labels:  raspberry-pi-camera, raspberry-pi-3
SimpleDALPlugin
Simple CoreMediaIO DAL virtual camera plugin example written in Swift
Stars: ✭ 138 (+711.76%)
Mutual labels:  webcam
EEGwithRaspberryPI
Open-Source board for converting RaspberryPI to Brain-computer interface
Stars: ✭ 402 (+2264.71%)
Mutual labels:  raspberry-pi-3
RPi-TELEBOT
Python based Telegram bot to monitor and control the raspberry pi
Stars: ✭ 19 (+11.76%)
Mutual labels:  raspberry-pi-3
Home-Monitoring-Raspberry-Pi-Node
Raspberry Pi & Node.js diy Home Monitoring & Intruder Alert system
Stars: ✭ 46 (+170.59%)
Mutual labels:  webcam
Backdoor
A backdoor that runs on Linux and Windows
Stars: ✭ 36 (+111.76%)
Mutual labels:  webcam

RPI PROJECT : WEBCAM WIRELESS STREAM

// PROJECT DESCRIPTION ////////////////////////////////////////////////////////////////////////////////////////

In this project, we will use a webcam with Raspberry Pi to live stream wirelessly. However, it can also be 
done with wired connection. The basic requirement is that both the Raspberry Pi and the device on which 
live stream is to be viewed are connected with same network. Rather than using the Raspberry Pi camera	
module,	we can use a standard USB webcam to take pictures and video on the Raspberry Pi. This project can 
be used for monitoring purposes. For eg- CCTV live surveillance camera.

// PRE-REQUISITE //////////////////////////////////////////////////////////////////////////////////////////////

1. Raspberry Pi (Tested with RPi 3)
2. Power Cable  (5V, 2A)
3. Access to RPi Using SSH
4. Webcam (Tested with Quantum QHM495LM)

// BACKEND WORKING ////////////////////////////////////////////////////////////////////////////////////////////

We will use fswebcam app to capture images with RPi. fswebcam is a neat and simple webcam app. fswebcam 
provides loop feature through which we can capture images in loop mode i.e. an image will be captured again
& again in specified time interval. We can take advantage of loop mode to stream it like a video instead of
still image. 

For streaming purpose, we will use 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, VLC, mplayer, 
and other software capable of receiving MJPG streams. MJPG streamer will take the image captured using 
fswebcam to display it as a live webcam stream over an ip address which can be accessed by any device such
as smartphone, laptop, desktop, etc. connected to the same network as Raspberry Pi.

// LIVE STREAMING USING RASPBERRY PI ////////////////////////////////////////////////////////////////////////////////////////////

<STEP 1> INSTALL BUILD DEPENDENCIES

Open a new terminal window.	To install the three libraries that MJPG-Streamer uses, execute the following 
command:
	$ sudo apt-get install libjpeg8-dev imagemagick libv4l-dev

<STEP 2> ADD MISSING VIDEODEV.H

The videodev.h header file that MJPG-Streamer needs has been replaced with a videodev2.h so we need to 
create a symbolic link.	A symbolic link is where a file in one directory acts as a pointer to a file in 
another directory. To create symbolic link:
	$ sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

<STEP 3> DOWNLOAD MJPG STREAMER

To download the source code of MJPG Streamer from terminal:
	$ wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip

-> Sometimes, the method provided below to download source code fails. In that case,download it manually from this link - http://sourceforge.net/p/mjpg-streamer/code/HEAD/tarball

<STEP 4> UNZIP MJPG STREAMER SOURCE CODE

The downloaded file is a compressed zip file so we need to extract the files to built it. Put the file in 
home directory(or a temporary folder, if you prefer) and run the following to extract the files:
	$ unzip mjpg-streamer-code-182.zip

<STEP 5> INSTALL BUILD DEPENDENCIES

MJPG-Streamer comes with several plugins, but we only need a couple of them to stream video. The command 
below only builds what's needed:
	$ cd mjpg-streamer-code-182/mjpg-streamer
	$ make mjpg_streamer input_file.so output_http.so

<STEP 6> INSTALL MJPG STREAMER

To install the mjpg streamer, execute the following commands which will copy all the necessary into system 
directories:
	$ sudo cp mjpg_streamer /usr/local/bin
	$ sudo cp output_http.so input_file.so /usr/local/lib/
	$ sudo cp -R www /usr/local/www

<STEP 7> INSTALL FSWEBCAM

To install the fswebcam package:
	$ sudo apt-get install fswebcam

<STEP 8> START THE CAMERA

Now, it's time to start the webcam:
	$ cd
	$ mkdir /tmp/stream
	$ fswebcam -l 1 -b --no-banner --save /tmp/stream/pic.jpg 

-> fswebcam also provides several other options. For more info, enter following command: $ fswebcam --help

<STEP 9> START MJPG-STREAMER

Almost Done! Now, webcam started capturing images in loop. To start MJPG-Streamer, enter the following 
command in terminal:
	$ LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /home/pi/tmp/stream -n pic.jpg" 
	  -o "output_http.so -w /usr/local/www"

<STEP 10> WATCH THE STREAM

To watch live stream on same raspberry pi, visit http://localhost:8080 in your web browser. To watch it 
from any other device i.e. computer or smartphone, visit http://<IP-address>:8080 from your web	browser. 
You can find the IP address used by Raspberry Pi from your router's homepage. Click on stream on the 
webpage and your streaming will be live. All Done! Just relax and enjoy the live stream.

<STEP 11> CLEANUP

After everything is working fine, we can remove the source files:
	$ cd ../../
	$ rm -rf mjpg-streamer-182

< BONUS > SCRIPT TO AUTO LIVE STREAM AT STARTUP

Run the start_live_stream.sh script on the startup to live stream from your webcam. You can run this script
by executing the following command on the terminal:

	$ ./start_live_stream.sh

< BONUS > STOP THE LIVE STREAM

To stop the live stream, we need to kill two processes- fswebcam and mjpg_streamer. Run the following
commands at the terminal, to find the Process ID's(PID) of the two processes:

	$ ps -e | grep mjpg_streamer
	$ ps -e | grep fswebcam
	
Above two commands will list the PID's of both the processes. Output of these commands will look like this: 
	17306 pts/1    00:00:00 mjpg_streamer
	15982 ?        00:00:01 fswebcam
	
Now to kill both the processes:
	$ sudo kill <PID_of_mjpg-streamer>
	$ sudo kill <PID_of_fswebcam>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].