I'm trying to start a recording every evening, starting from 19:00 and stopping at 02:00. The webcam does export its stream as rtsp video stream and I am able to start the recording correctly with VLC using this:
filename="/path/to/video-`date +%Y%m%d%H%M`.mp4"
length=25200
cvlc rtsp://192.168.2.186/play2.sdp\
--sout="#std{access=file,mux=ps,dst=$filename}"\
--run-time=$length\
--play-and-exit
For some reason it sometimes loses the connection (my guess is the WiFi is blocked). No matter how hard I try I can't get vlc to reconnect and just continue writing to the file where it left off. Any pointers to what I should be looking into?