This technique requires ffmpeg as well as a webcam that is properly supported under linux. For this example I will assume that your video shows up as /dev/video0, but you can check by unplugging your webcam, running ls /dev/video*, and then plug in your web cam and run it again. If a new line shows up, this will be the device representing your webcam.