Введение
Пример кода на сервере
#!/bin/sh
#
SOURCES="/var/www/webcam"
ARCHIVE="/var/www/webcam/archive"
#
CMD=$1
FPS="1"
BIT="1200"
#
#
ls -l --full-time $SOURCES/*.jpg | tr './' ' ' | tr ':' '-' | awk '{print $6,$7,$16}' | while read date time mac; do
if [ "$CMD" = "archive" ] ; then
mkdir -p $ARCHIVE/$mac
cp $SOURCES/$mac.jpg $ARCHIVE/$mac/$date-$time.jpg
ln -sf $ARCHIVE/$mac/$date-$time.jpg $ARCHIVE/$mac/last.jpg
elif [ "$CMD" = "timelapse" ]; then
mkdir -p $ARCHIVE/$mac
mencoder mf://$ARCHIVE/$mac/$date-*.jpg -mf fps=$FPS:type=jpg -ovc x264 \
-x264encopts bitrate=$BIT:threads=2 -o $ARCHIVE/$mac/$date-timelapse.mkv >/dev/null 2>&1
# For music: -oac copy -audiofile audiofile.mp3
fi
done
exit 0
Внешние ссылки