Webcam app - record video when motion is detected

Is it possible to create an webcam app with appinventor to record an video when motion ist detected with my smartphone.
I will fix my smartphone on a special place.
I will record when a motion is detecte and will upload the video to a ftp server.
Hope somebody can help me to solve such a project.
kindly regards