Re: Unsychronous recording from DV cameras



Welcome to DirectShow :)

What you need is correct timestamps, something DirectShow does not provide in the design and always make audio/video sync a gamble.
The only time audio/video is accurately in sync is when the source send packet with audio video muxed.
(But then you still have no accurate time of actual world capture, like if you want to sync two camera together.)

Your problem is that when you receive a packet (audio & video) you dont have its capture time stamp.
With DV from the time the imager discharge to the time you get it on your filter pin, a 'random' amount of time elapse.
For the audio it depend on the driver, but the 'randomness' is small enough that it usually acceptable.

So for DV expect an extra 2 to 4 frames latency compared to analog. So delay your audio by 120ms (with pal camera PAL)
if you are now getting perfect sync with analog, and you should get something acceptable without user interaction.
You could also write a calibration wizard and save the latency with the DV camera ID.
Or propose you users to plug their mic on the DV camera itself.

BTW, this is all minor problems compared to drift issues you will be facing with long recording when using an audio card to capture.
If you dont do live you can resample your audio stream as a post process to match your video stream... that or spend
allot of time doing fuzy logic to generate timestamps that can be used for on the fly resampling.

You might want to investigate Vista API using the new audio driver model, manufacturer have the 'option' to expose
the audio clock for drift correction. And see if you can wait untill 2007 to possibly do it right
(big question, because I cant tell if it will finaly work or not)

Anyway.. the multimedia situation on Windows is so pathetic I dont know if I should laugh or cry.
(Go watch some of the MS audio/video people on channel9, and be scared!)

Good luck and may the 'Hack' be with you (You will need it working with DShow)

Stephan

"Ulrich K" <Ulrich K@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:2F2EA379-3316-4EDD-A667-83F60DC8239C@xxxxxxxxxxxxxxxx
Hi.

We have a software that amongst other things records audio and video (an
AVI). The video can come from an arbitrary WDM capture source. The audio can
be any of the installed audio capture sources.
Now, if the video comes from a DV camera the recorded audio and video are
slightly out of sync.

It is important to note here that the audio is not the one coming with the
DV stream from the camera but the one coming from the computer's sound card.
The deviation varies between different types of cameras and is usually
between +100 and +300 milliseconds and thus noticeable.

This problem also occurs on different computers and it also occurs not only
in our software but with a very simple sample program (using DirectShow) that
i've written.
It does however not occur with non-DV video sources like analog capture cards.

I have tried all different sorts of things like tweaking buffer sizes
(IAMBufferNegotiation), defining a master stream
(IConfigAviMux.SetMasterStream()), or setting the sync source of the graph to
the system clock (IMediaFilter.SetSyncSource()).
When I use IAMGraphStreams.SyncUsingStreamOffset(TRUE) the effect is
reversed and the deviation is maybe -300 milliseconds.

We are using a DirectX 9.0 from maybe 2004.

Any further help or hints on this matter would be much appreciated.


.



Relevant Pages

  • Re: DTV audio / vidio sync
    ... stay in sync. ... make delay adjustments differentially, any delay of some part of the A/V ...
    (sci.engr.television.broadcast)
  • RE: Green Screen/ Full Screen Issue
    ... DirectShow Filters ... Indeo® video 5.10 Decompression ... MainConcept MPEG Audio ... Realtek HD Front Green Jack,0x00200000,1,1,,5.03.2600.2180 ...
    (microsoft.public.windowsmedia)
  • Re: Why is everything on E4 always out if lipsync ?
    ... After playing a video there was always a lip sync ... i.e. why is it necessary to code audio & video separately. ... or shortage of memory for buffering to cause loss of sync. ...
    (uk.tech.digital-tv)
  • Re: Audio/video is not in sync
    ... There are a number of shows on my cable system that the audio ... MCE viewing, I have noticed that if the channel doesn't tune in immediately, ... there may be some audio and video skew. ... If the CPU is more than 50% busy you may have sync issues. ...
    (microsoft.public.windows.mediacenter)
  • Synchronize and PushSource filter
    ... I have a directshow client/server application using a custom video ... ** Video Stream ... ** Audio Stream ...
    (microsoft.public.win32.programmer.mmedia)