Audio/Video Synchronizer: Usage Hints

From AVObjects Knowledge Base
(Difference between revisions)
Jump to: navigation, search
 
(Using In GraphEdit)
 
(6 intermediate revisions by one user not shown)
Line 2: Line 2:
  
 
==Using In GraphEdit==
 
==Using In GraphEdit==
 +
 +
[[Image:AVSynchronizer1.gif|thumb|300px|right|Need comment here...]]
 +
[[Image:AVSynchronizer2.gif|thumb|300px|right|Need comment here...]]
  
 
1. Build graph with Audio/Video Synchronizer taking into account the following:
 
1. Build graph with Audio/Video Synchronizer taking into account the following:
Line 18: Line 21:
  
 
3. Start the graph.
 
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
 
  
____________________________________________________________________
+
a). If chosen "Auto" FPS: filter will skip all samples 4 seconds, it needs this time for next reasons:
  
Q&A
+
1) determine FPS
  
Q.
+
2) determine size of audio sample
> why a separate filter for audio video synchronization?
+
 
 +
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==
  
A.
 
In usual cards for record of a video (not DV cards) there is no
 
synchronization for video and audio streams. In result there is a mismatch
 
of a sound and image in film. A/V Synchronizer corrects of Reference Clock
 
for elimination of this mismatch. From our tests of A/V Synchronizer: the
 
mismatch does not exceed 1-2 frames for one day. Without A/V Synchronizer:
 
mismatch can achieve several tens seconds for one day.
 
  
 
Q.
 
Q.
Line 53: Line 45:
 
A.
 
A.
 
The synchronization is made as follows:
 
The synchronization is made as follows:
 +
 
1. A/V Synchronizer sets the own Reference Clock as graph clock.
 
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
 
2. By default audio source and video source uses this clock for time
 
stamping of samples.
 
stamping of samples.
 +
 
3. A/V Synchronizer receives audio samples and accumulates time stamps/media
 
3. A/V Synchronizer receives audio samples and accumulates time stamps/media
 
times for audio samples.
 
times for audio samples.
 +
 
4. A/V Synchronizer periodically calculates difference between time stamps
 
4. A/V Synchronizer periodically calculates difference between time stamps
 
and media times and makes Reference Clock corrections.
 
and media times and makes Reference Clock corrections.
 +
 
5. Video source sets time stamps for video frames from Reference Clock from
 
5. Video source sets time stamps for video frames from Reference Clock from
 
A/V Synchronizer (that is appropriate to quartz from audio channel).
 
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
 
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
 
Synchronizer makes correction of FPS for video stream with the help of video
 
frames rejection/duplication (if difference more than threshold value).
 
frames rejection/duplication (if difference more than threshold value).

Latest revision as of 13:47, 18 October 2007

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

Using In GraphEdit

Need comment here...
Need comment here...

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