The software additionally needed on a Linux machine is:
- FTP server proftpd for uploading images from the cam when motion detected (and triggering the recording). You can use another FTP server software. However the ftp access log file and format can be different.
- Ffmpeg with x264 encoder and drawtext filter for recording MJPEG stream from the cam into mp4 videos
- AtomicParsley for checking mp4 files for consistence
- MP4Box for merging the mp4 files into one video file
- Imagemagick for adding timestamp to single images
- Inotify tools for triggering the recording
Installing proftpd on Debian Squeeze is very easy:
apt-get install proftpd
I let it run as standalone server. Then open /etc/proftpd/proftpd.conf and change or add following lines.
# chroot for all users of the group ftpuser DefaultRoot ~ ftpuser # Enable login only for members of ftpuser <limit LOGIN> DenyGroup !ftpuser </limit> # Disable Reverse DNS Lookups and IP6 for more speed UseReverseDNS off UseIPv6 off
Now create a group ftpgroup which will contain all the ftp users and allow them to connect using shell /bin/false.
addgroup ftpuser echo "/bin/false" >> /etc/shells /etc/init.d/proftpd restart
Installing Ffmpeg with x264 encoder support is not that easy as we have to compile Ffmpeg with x264 and drawtext filter support from the source files. Here it how it works:
cd ~ mkdir videoencode cd videoencode wget http://www.debian-multimedia.org/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2010.12.26_all.deb dpkg -i debian-multimedia-keyring_2010.12.26_all.deb nano /etc/apt/sources.list # Add these two lines to /etc/apt/sources.list deb http://www.debian-multimedia.org stable main deb-src http://www.debian-multimedia.org stable main # Install some prerequisites apt-get update apt-get remove ffmpeg x264 libx264-dev apt-get install build-essential subversion git-core checkinstall yasm \ texi2htm libfaac-dev libfaad-dev libsdl1.2-dev libx11-dev libxfixes-delibxvidcore4-dev \ zlib1g-dev ttf-freefont apt-get install libmp3lame0 libmp3lame-dev # Install x264 encoder library git clone git://git.videolan.org/x264.git cd x264 ./configure make checkinstall --pkgname=x264 --pkgversion "1.0`date +%Y%m%d`" --backup=no --default # Install Ffmpeg with libavfilter (need to use drawtext filter) cd ~/videoencode svn co svn://svn.ffmpeg.org/soc/libavfilter cd libavfilter ./checkout.sh cd ffmpeg ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postpro \ --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libxvi \ --enable-x11grab --enable-filter=drawtext --enable-libfreetype make checkinstall --pkgname=ffmpeg --pkgversion "0.svn`date +%Y%m%d`" --backup=no --default # Install qt-faststart tool make tools/qt-faststart cp tools/qt-faststart /usr/bin/ chmod 755 /usr/bin/qt-faststart # Prevent installed packages from autoupdates echo "x264 hold" | dpkg --set-selections echo "ffmpeg hold" | dpkg --set-selections
AtomicParsley, MP4Box, Imagemagick and Inotify are straight forward.
apt-get install atomicparsley apt-get install gpac apt-get install imagemagick apt-get install inotify-tools
Good luck!