How do I resume an interrupted video stream recording?

view story

http://askubuntu.com – 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://\ --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 le (HowTos)