Here is a fast and easy way to record your videos using pulseaudio.
ffmpeg -f alsa -i pulse -ac 2 -acodec pcm_s16le -f video4linux2 -s 640x480 -r 30 -i /dev/video0 -threads 0 -vcodec libx264 -vpre lossless_ultrafast test.mkvavconv -f alsa -i pulse -acodec pcm_s16le -f video4linux2 -s 640x480 -r 30 -i /dev/video0 -threads 0 -vcodec libx264 -preset ultrafast test.mkv
For this to work, you need to have your ffmpeg compiled with libx264 support. Debian users can either compile it or just use the multimedia repository.