Back to home

How to: RaspberryPi as a motion camera

Install v4l

sudo apt-get install libgtk2.0-dev libjpeg9-dev
cd /usr/src
git clone git://git.linuxtv.org/v4l-utils.git
cd v4-utils
./bootstap.sh
autoreconf -vfi
make
sudo make install

Install x264

cd /usr/src
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make
sudo make install

Install ffmpeg with libfaac

sudo apt-get install libfaac-dev libmp3lame-dev libxvidcore-dev libgsm1-dev libtheora-dev libvorbis-dev
cd /usr/src
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmepg
./configure --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libgsm --enable-postproc --enable-libxvid --enable-libfaac --enable-pthreads --enable-libvorbis --enable-gpl --enable-nonfree
make
sudo make install
sudo ldconfig

Enable /dev/video0

sudo modprobe bcm2835-v4l2

Disable the red LED

Update the /boot/config.txt with:

disable_camera_led=1

And reboot (sudo reboot).

Basic HTTP Live stream

raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264

And open "http://:8090" on VLC.

Standard definitions:

Resources