Raspberry pi jam july

Preview:

Citation preview

RASPBERRY PI JAM

Setup Raspberry Pi as CCTV client

Who am I?

• Name : Jon Ho• Occupation : Simcard OneXOX seller– Buy my prepaid card and top up RM 50, and you

get 2 years validity, FOR FREEEEEEE!• Part Time : Freelancer/Maker• Some Time : Busker/Farmer/Fisherman

CCTVRM1,020 vs RM1,980

RECIPE

• Hardware– 1 Command & Control Windows PC– Nth number of client Pi Camera

• Software– Raspbian Jessie on Raspberry Pi– Raspivid

www.raspberrypi.org/documentation/raspbian/applications/camera.md

– Zenmap, Mplayer on Windows PC

Linux Streaming• VLC

– Slowest– Easiest to set up

• Gstreamer– So-so speed– Complex to set up

• Netcat– Fastest!– No setup needed! Runs out of the box!

gator

What you need

• 1: Raspberry Pi 3

What you need (cont)

• 2: Pi Camera Module (Noir)

What you need (cont)

• 3: PC/Laptop Windows with zenmap/ncat (for network streaming stuff) and mplayer (for video stuff) installed– Both are opensource and freeeeee

Step 1: setup the C&C

• First, find out your C&C PC’s ip– Open a terminal in windows and run ipconfig

– Remember the ip, this is what your raspi will connect to

Step 1: setup the C&C (Cont)

• Second, in the same terminal, run ncat to pipe the stream to mplayer– C:\Users\jon>ncat -l -p 2222 | "C:\Program Files (x86)\MPlayer for

Windows\mplayer.exe" -fps 200 -demuxer h264es –– The -demuxer h264es arguments decode the stream into mpeg 4

Step 2: setup the pi camera• Setup Camera

– There are tons of tutorials of how to setup pi camera, so I will not cover that. Just make sure it looks something like below.

– Also if possible, try to get an enclosure for the raspi camera. You don’t want it to die every time somebody sneezes at it

Step 2: setup the pi camera (cont)

• Test Camera by running this command in the terminal– raspivid -o heuheuheu.h264 -t 10000– omxplayer heuheuheu.h264

Step 3: profit!

• Now put it all together by running this command on the raspi camera– raspivid -t 0 -w 1280 -h 720 -hf -ih -fps 20 -o - | nc 192.168.1.4 -k -l -p 2222

The –t 0 argument means raspivid will basically run forever streamed on port 2222

It’s alive!• It’s working!

Bonus Points

• SOUND– The demo had no sound, due to lack of usb mic. It

can stream sound. Try it out as homework.

• NETWORK SPEED– For best live action speed, use a wireless router

that can transmit on the 5GHz band. 2000++ Mbps means no lag whatsoever!

Bonus Points (cont)• MULTIPLEXING CAMERA– It is possible to multiplex the camera, although

stability issue may arise.

To learn more

• Raspivid– www.raspberrypi.org/documentation/raspbian/

applications/camera.md

• Netcat– www.binarytides.com/netcat-tutorial-for-

beginners/

DONATE• If you think this is cool beans and would like to send free money

so I don’t starve to death and keep making stuff like this, send it here:

BITCOIN1GhVoWnYq21mDEC6nSn2WZkuoPMAAarJrk

LITECOINLS1N3L34feg7GwwLWmcTqsmzfoUtzSMME6

Recommended