Sometimes it happens, when it is much better to keep your records of the surveillance system remotely. (and i have noticed, that HowToForge still doesn't have a such tutorial) My brief variant: cd / mkdir REPOSITORY && cd REPOSITORY mkdir DVR && cd DVR Creating script, which tells to record segments, splitting them hourly. (bash script: dvr_rec.sh) nano dvr_rec.sh #!/bin/bash ######### Lock checker ########### myName="`echo $0 | awk '{print $NF}' FS='/'`" lockDir="/var/lock/" lockFile=$lockDir$myName.pid currentPID=$$ oldPID="`cat $lockFile`" oldderExist=` kill -0 $oldPID 2>/dev/null ; echo $? ` if [ "$oldderExist" == "0" ]; then echo "An Other Instance Is Running...! PID:$oldPID" ; exit ; else echo $currentPID > $lockFile ; fi ######### Lock checker ########### while true do if [ -z "$1" ]; then IP_ADDRESS=<my_opened_ip_to_connect_with_camera> USER=<name>; PASS=<password> RTSPPORT=<enabled_port> else IP_ADDRESS=$1 fi # FFMPEG command for creating segments from RTSP stream ffmpeg -i rtsp://${USER}:${PASS}@${IP_ADDRESS}:${RTSPPORT}/trackID=1 -map 0 \ -codec:v libx264 -crf 21 -acodec copy -b:v 800k -b:a 96k -preset fast -tune zerolatency \ -f segment \ -strftime 1 -segment_time 3600 -segment_format mp4 "/REPOSITORY/DVR/records/%Y_%m_%d-%Hh%Mm%Ss.mp4" sleep 0.5 done !verify, that you have a such path: /REPOSITORY/DVR/records (or create your own) (making service) nano dvr_rec.service [Unit] Description=DVR records [Service] ExecStart=/REPOSITORY/DVR/dvr_rec.sh Restart=on-failure [Install] WantedBy=multi-user.target chmod +x /REPOSITORY/DVR/dvr_rec.sh ln -s /REPOSITORY/DVR/dvr_rec.service /lib/systemd/system/dvr_rec.service systemctl enable dvr_rec.service systemctl start dvr_rec.service systemctl status dvr_rec.service The most important part - to remove staled data; your storage has not an unlimited capacity. Script - erasing not needed files nano remove_dvr_records.sh: #!/bin/bash while true do LOCATION=/REPOSITORY/DVR/records REQUIRED_FILES=*.mp4 find $LOCATION -name $REQUIRED_FILES -type f -mtime +2 -delete sleep 21600 done remove_dvr_rec.service [Unit] Description=Remove old DVR records [Service] ExecStart=/REPOSITORY/DVR/remove_dvr_records.sh Restart=on-failure [Install] WantedBy=multi-user.target