I used raspicam commands in cron to click still images at specified time instants.

I used ffmpeg to stitch the pictures together into a video and overlaid a timestamp on each frame. The timestamp is automatically generated using the frame rate and the start time of the recording. Depending on the length of the video and the size of the images, ffmpeg can take a while to finish. So, it’s best to use a computer with decent amount of RAM.

# code to stitch still frames into a video with an overlaid timestamp
sudo ffmpeg -framerate 16 -pattern_type glob -i '2017-04-28_*.jpg' 
-vf drawtext="fontfile=/Library/Fonts/Arial.ttf: text='%{eif\:n*5\:d\:3} mins after 5 AM': 
fontcolor=black:fontsize=100:shadowcolor=black" output.mp4