If wanting to record desktop a certain time like for 5 minutes, it can do via Terminal or script like
zenity --info --text="Start recordmydesktop and kill recordmydesktop in 5 minutes ."
recordmydesktop --on-the-fly-encoding & sleep 300 #keep recording for 5 minutes
kill `echo $!`
If wanting to stop earlier, run