wxCam is a webcam application for linux. It supports video recording (in an avi uncompressed and Xvid format), snapshot taking, and some special commands for philips webcams, so you can also use the program for astronomy purposes. It supports both video4linux 1 and 2 drivers, so it should work on a very large number of devices. In addition it supports motion detection.
There are no reported vulnerabilities