Audio/Video Synchronizer: Usage Hints

From AVObjects Knowledge Base
Revision as of 13:43, 18 October 2007 by Admin (Talk | contribs)
Jump to: navigation, search

Below are a few hints on using the Audio/Video Synchronizer DirectShow filter.

Using In GraphEdit

1. Build graph with Audio/Video Synchronizer taking into account the following:

  • The filter is designed only for live audio and video sources. Don't use the filter for file sources.
  • Don't insert any filters between live source filters and A/V Synchronizer: these filters can change parameters of original audio and video streams.
  • A/V Synchronizer should receive streams without key frames (uncompressed RGB, YV12, YUY2, MJPEG, etc.; do not use with MPEG-1, MPEG-2, MPEG-4 or MP3 streams).
  • The filter will pass all audio samples unchanged, but some of the video frames will be duplicated or skipped.

2. After building the graph open the AVSync's filter properties and click on "Set synchronized Reference Clock". From this moment the whole graph will work with our clock. Also you can change FPS.

The main advantage of usage of the reference clock instead of simple time correction is that the whole graph will work in one time (not real, but very like to real-time).

3. Start the graph.

a). If chosen "Auto" FPS: filter will skip all samples 4 seconds, it needs this time for next reasons: 1) determine FPS 2) determine size of audio sample 3) wait for stream's stabilization (capture devices usually works unstable first seconds - very floating FPS, for example) 4) wait for pair of samples (one audio and one video) with synchronized start time.

b). If one of the fixed values is chosen: the filter at once starts to send samples to downstream filters


QA

Q. > In our system, we have both audio, video running with separate > clocks.we get timestamps along with the audio, video buffers from > respective drivers. how helpful your filter be in this case? >

A. The synchronization is made as follows:

1. A/V Synchronizer sets the own Reference Clock as graph clock.

2. By default audio source and video source uses this clock for time stamping of samples.

3. A/V Synchronizer receives audio samples and accumulates time stamps/media times for audio samples.

4. A/V Synchronizer periodically calculates difference between time stamps and media times and makes Reference Clock corrections.

5. Video source sets time stamps for video frames from Reference Clock from A/V Synchronizer (that is appropriate to quartz from audio channel).

6. The AVI-file should have all video frames of identical duration. A/V Synchronizer makes correction of FPS for video stream with the help of video frames rejection/duplication (if difference more than threshold value).

Personal tools