Recording Video with Good Synced Audio from Webcam

One of the little joys of using Linux is that sometimes you have to play with the switches and wires to make things work right.  For some reason, it takes a small miracle to record decent video via a webcam.  The most popular program is cheese, but I could not make it work right.  The audio and video were way off and laggy.  The program kamoso did work, mostly, but I didn’t have any control over size, speed, etc, and sometimes the video was garbled or wouldn’t save.  I would have really liked to use kdenlive, since I’ve learned to use it and think it is pretty cool.  The problem there is all the new ubuntu (and mint) distros use pulseaudio to handle the audio, and kdenlive has no support for it.

So, here is what I found that works like a charm:

(from http://brightedges.blogspot.com/2008/06/webcam-and-mplayer.html)

  • install the good, bad, and ugly gstreamer-plugins
  • install the non-standard package called GEntrans which “provides a gstreamer element named ‘stamp’ that can apply timestamps to incoming video streams in a way that they can later by perfectly matched to the incoming audio streams to produce perfectly sync’d output”
  • issue the massive command below
gst-launch-0.10  v4l2src queue-size=16 !  stamp sync-margin=1 sync-interval=1     ! video/x-raw-yuv,width=800,height=600,framerate=15/1     ! queue2 max-size-buffers=1000 max-size-bytes=0 max-size-time=0  ! ffmpegcolorspace     ! theoraenc quality=60 name=venc  alsasrc device="hw:2,0"     !  audio/x-raw-int,rate=16000,channels=2,depth=16     !  audioconvert ! queue2 max-size-buffers=1000 max-size-bytes=0 max-size-time=0     !  vorbisenc quality=0.9 name=aenc oggmux name=mux ! filesink location=BrianWebcamVideo.ogg aenc. ! mux. venc. ! mux.
This entry was posted in How-To, Technology and tagged , , , , . Bookmark the permalink.