Skip to content

Instantly share code, notes, and snippets.

@bgerm
Created June 19, 2013 14:58
Show Gist options
  • Save bgerm/5814986 to your computer and use it in GitHub Desktop.
Save bgerm/5814986 to your computer and use it in GitHub Desktop.
Record web camera activity in a cron job using VLC.
#!/bin/sh
# Record web camera activity in a cron job using VLC.
# This is in a script so that I don't have to go through
# the vlc man pages again. Plus, somethings have unexpected
# behavior, such as requiring --run-time and --stop-time
# to be run together so it doesn't hang.
# Camera used: Foscam FI8910W camer
# Cron
# */30 1,2,3,4,5,6 * * * ~/streams/record.sh 1680 ~/streams/out/ http://admin:@192.168.2.118/videostream.cgi 2>&1 >> ~/streams/record.log
if [ $# -ne 3 ]
then
echo "Usage: `basename $0` DURATION OUTDIR HTTP_STREAM"
exit 65
fi
dur=$1
out=${2%/}
stream=$3
runtime=$(date +%Y-%m-%d-%H:%M)
dst=$out/$runtime.ts
/Applications/VLC.app/Contents/MacOS/VLC -I dummy -v $stream --sout "#standard{access=file,mux=ts,dst=$dst}" --http-reconnect --preferred-resolution 240 --run-time $dur --stop-time $dur vlc://quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment