[Matroska-users] MKVMerge VFR Audio Sync Problem

Stephen Anderson stephen.c.anderson at gmail.com
Wed Mar 7 00:28:42 CET 2007


Can some one help me figure out how to eliminate or at least reliably
predict (so I can counteract) the audio sync problems that I'm
experiencing when merging VFR MKVs together?

You can read a more detailed description of my problem and get a test case from:

In short, I have found that when I merge together several VFR mkv
files, I get an ever increasing audio sync problem.  The audio stays
at the same rate for the duration of the individual clips, but gets
progressively more out of sync at each successive merge point.

This is what I _think_ is happening, but my most recent test till
shows some discrepancy:

I have two, plain color constant tone 5s long video clips.  These are
put through the DeDup filter prior to encoding an are "decimated" down
to 4 frames with the following timecode file:
# timecode format v2

What I think is happening is MKVMerge doesn't look at the audio track
to determine how long that last frame (at 4s) should play before the
first frame of the next merged segment.  I _think_ MKVMerge sees that
there was a 1.333333s difference between the previous frames so it
_assumes_ (incorrectly) that the first frame of the next clip should
start at 5333.3333.

Extracting the timecode file from the merged video supports this as
the next timecode reported is 5333, not 5000 (which would be where the
first clip's audio ends).  Now if the audio is blindly concatenated,
the audio transition will happen at 5s and the video will happen at
5.3333s.  So at every merge point, the audio is getting 333ms ahead of
the video.

Operating on this hypothesis, I re-merged the files together but
placing a 333ms delay on each audio track except the first one.  What
baffles me is that now this new video plays much closer to in-sync,
but the _video_ is now getting slightly ahead of the audio at each
merge point!  I can't figure out why my conjecture about the 333ms
delay would be close but slightly too large.

Can someone please help me.  I've been plauged with these sync issues
for years and have only now pulled out so much hair that I decided to
invest the energy in this kind of simplified test case.  But now I
just don't understand the results I'm seeing.

Thanks so much,

More information about the Matroska-users mailing list