title: Audio Sync problems using DirectShow.NET
body: <p>I have started a thread on this at DirectShow.NET's forum, here is the link <a href="http://sourceforge.net/projects/directshownet/forums/forum/460697/topic/5194414/index/page/1" rel="nofollow">http://sourceforge.net/projects/directshownet/forums/forum/460697/topic/5194414/index/page/1</a>
  but unfortunately the problem still persists...</p>
  
  <p>I have an application that captures video from a webcam and audio from the microphone and save it to a file, for some reason the audio and video are never in-sync, i tried the following:
  1. Started with ffdshow encoder and changed to AVI Mux - problem persists, audio is delayed and at the end of the video the picture remains frozen and the audio continues
  2. Changed from AVI Mux to WM ASF Writer - video is frozen at the beginning (2 seconds) and rest of video is in-sync (but the two first seconds are not usable)
  3. create SampleGrabber that prints the timestamp for both audio and video - saw that the audio timestamp is 500ms earlier but I have no idea what to do with this fact...
  4. tried manually setting the ReferenceClock to one of the capture filters (audio/video) but both won't cast to IReferenceClock
  5. Created a SystemClock and set it has the ReferenceClock - made no difference
  6. Set SyncUsingStreamOffset(true) on the grap - timestamps are much closer now but the final result is the same
  7. Tried saving the audio and video to two different files and used VirtualDub to see if they match, they still dont...</p>
  
  <p>Oh i forgot to mention I also tried building the graph in GraphEditPlus but the problem still remains, here's a link to the graph: <a href="http://www2.picturepush.com/photo/a/8030745/img/8030745.png" rel="nofollow">http://www2.picturepush.com/photo/a/8030745/img/8030745.png</a></p>
  
  <p>Currently I am testing all my changes on the CapWMV sample from DirectShow.NET's samples.</p>
  
  <p>Please any advice would be highly appreciated, I am hopeless :/</p>
  
  <p>Thanks,</p>
  
  <p>Eran.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>It seems there's a constant 500ms gap between the audio and video, if I use virtualDub to delay the audio by 500ms it looks fine, how can set this in the graph?</p>