AppleScript to record webcam video
Someone at Apple communities helped me resolve the issue. Posting an answer if someone faces the same issue. 

 set theCurrentDate to current date
set dateTime to short date string of theCurrentDate &amp; space &amp; time string of theCurrentDate
set P to offset of "/" in dateTime
set dateTime to text 1 through (P - 1) of dateTime &amp; "-" &amp; text (P + 1) through -1 of dateTime
set P to offset of "/" in dateTime
set dateTime to text 1 through (P - 1) of dateTime &amp; "-" &amp; text (P + 1) through -1 of dateTime
set theFilePath to "/Users/rohitbhutani/Desktop/movie " &amp; dateTime &amp; ".mov"

tell application "QuickTime Player"
     set newMovieRecording to new movie recording
     tell newMovieRecording
           start
           delay 5
           pause
           save newMovieRecording in POSIX file theFilePath
           stop
           close newMovieRecording
     end tell
end tell