News:

The Latest electronic and computer Tips that work!

Main Menu

ffmpeg Recording a stream or from IP camera

Started by branx86, December 24, 2015, 10:31:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86


#Save from ip camera
ffmpeg -i http://admin:admin@192.2.2.1:554/dd-a -c copy -map 0 -f segment -segment_time 300 -segment_format mp4 "outfile.mp4"

# 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
# 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
BASEpath='/path/to/surveillance/folder'
RECpath=$BASEpath'/video'
ffmpeg -i rtsp://username:password@192.168.1.201:80/videoMain -r 30  -vcodec copy -an -t 900 $RECpath/cam01/$name.mp4 </dev/null >/dev/null 2>/tmp/cam01.log &

#Cronjob- It looks into the archive folders, looking for directories, as each day has its own, older than 5 days
0 4 * * * find /path/to/surveillance/folder/archive -mindepth 3 -type d -mtime +5 -exec rm -r {} \;