Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Record Foscam IP camera live feed
# ------------
# This script saves the live video from the Foscam IP camera to a full-quality mp4 file.
# I chose to split the files every 15 minutes (900 seconds), to quickly find the time I need.
# Note: audio is not saved as my cameras don't have a microphone connected to them.
# -----------
# Author: @LucaTNT
# License: BSD
# Uncomment this line if you're having trouble with zero-sized files (tipically happens on low end cameras), thanks Eric! (
# killall -INT ffmpeg
# The file name. I use the date to make finding files easier.
name="`date +%Y-%m-%d_%H.%M`"
# Where the videos will be saved
# Save the streams using ffmpeg at 30 fps, stopping the capture after 900 seconds (15 minutes). Add more lines if you have more than 2 cameras
ffmpeg -i rtsp://username:password@ -r 30 -vcodec copy -an -t 900 $RECpath/cam01/$name.mp4 </dev/null >/dev/null 2>/tmp/cam01.log &
ffmpeg -i rtsp://username:password@ -r 30 -vcodec copy -an -t 900 $RECpath/cam02/$name.mp4 </dev/null >/dev/null 2>/tmp/cam02.log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.