title: Recording from tv tuner/webcam with gstreamer and audio/video going out of sync
body: <p>I have a TV tuner card that shows up as <code>/dev/video1</code>. I am trying to digitize some old VHS tapes. The TV tuner doesn't do audio, I have a wire connected to my microphone in.</p>
  
  <p>This is the gstreamer pipeline I'm using to capture video &amp; audio and save it to a file. I'm using motion jpeg because I don't want it to drop frames and lose content. I'll re-encode it better later.</p>
  
  <pre><code>gst-launch-0.10 v4l2src device=/dev/video1 ! \
      queue ! \
      video/x-raw-yuv,width=640,height=480 ! \
      ffmpegcolorspace ! \
      jpegenc ! \
      avimux name=mux ! \
      filesink location=output.avi \
     pulsesrc ! \
      queue ! \
      audioconvert ! \
      audio/x-raw-int,rate=44100,channels=2 ! \
      mux.
  </code></pre>
  
  <p>This all works well and good. I have files that play that have video and audio. However sometimes when playing the output files, the audio &amp; video goes out of sync. It happens at the same place in the video, on numerous different media players (totem, mplayer). So I think this is a problem in how I'm saving and recording the file.</p>
  
  <p>Is there anything I can do to the pipeline to make it less likely to suffer from audio/video sync problems? I'm a bit of a newbie to gstreamer and video/audio codecs, so I might be doing something stupid here (please point out!). Is there any video/audio/muxer codec that would be better?</p>