[Mencoder-users] a-v synchronization problems with xvid and -oac copy

Eric Thornton gonesurfing at nc.rr.com
Sun Jun 5 07:55:25 CEST 2005


I came across this thread a few weeks ago, describing a problem that I
was having using mencoder -ovc xvic -oac copy.

http://www1.mplayerhq.hu/pipermail/mencoder-users/2005-April/000817.html


Basically, encoding to xvid and copying 5.1 stream (-oac copy) will give
result of an .avi with the sound 100ms-200ms off, usually ahead of the
video.  Encoding to xvid with -oac mp3lame (cbr,abr,vbr) does not have
the same problem and the sound is usually just right.  Thinking this is
an mencoder or demuxer issue, i tried the same problem dvd's with lavc's
mpeg codec and -oac copy gave perfect results.

As stated in above thread, not all sources have this issue. Well, to be
more correct is seems that some sources are more noticably off that
others.  Using 0.75 speed i seem to notice sync if its more than 100ms
off in either direction.  It seems that the dvd's that give the biggest
sync problems are the ones where there are several duplicate frames
detected at the start of the film before NTSC framereate is detected.
The ones that sync OK with xvid and AC3 don't have this non NTSC
framerate at the beginning or only have 1 or 2 of these frames. To
further prove that this "duplicate frame" is related to AV sync with
xvid, I tried encoding one of the problem dvd's beginning at chapter 15
with good results. However, using "-ss 4" to cut out the first few
seconds of non NTSC frames doen't always help. Usually, if I cut out
what should contain all the duplicate frames with -ss -10 for example,
I'll still get duplicate frames as the film "catches up" to framerate.
Obviously, I'm not an expert at dvd and video formats so I am asking for
help. I could just use lavc which is a great set of codecs, but xvid
1.1's betas have been giving me beter video results lately.

I am using 1.0pre7-3.4.2 and have duplicated the problem with xvid
versions 1.1-beta2, 1.1-beta1, and 1.0.3. The problem seems to occur
both with and without bframes. I always encode from NTSC using -ofps
24000/1001. Below is a sample that will yield a slightly out of sync
(+100ms) encode of a movie with output below.

mencoder dvd://1 -dvd-device /home/eric/dvdrip/DVD_VIDEO -aid 128 -oac
copy -ovc xvid -xvidencopts
trellis:quant_type=h263:vhq=2:me_quality=6:chroma_me:closed_gop:max_bframes=2:bitrate=700 -vf crop=716:464:2:6,scale=480:256   -ofps 24000/1001 -o "file.avi"

This will yeild good (nearly perfect) AV sync

mencoder dvd://1 -dvd-device /home/eric/dvdrip/DVD_VIDEO -aid 128 -oac
mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts
trellis:quant_type=h263:vhq=2:me_quality=6:chroma_me:closed_gop:max_bframes=2:bitrate=700 -vf crop=716:464:2:6,scale=480:256   -ofps 24000/1001 -o "file.avi"

The start of one "problem" film

1 duplicate frame(s)!
Pos:   0.3s     10f ( 0%)   0fps Trem:   0min   0mb  A-V:0.026 [0:0]
Skipping frame!
Pos:   0.5s     15f ( 0%)   0fps Trem:   0min   0mb  A-V:0.033 [0:0]
Skipping frame!
Pos:   0.6s     20f ( 0%)   0fps Trem:   3min  77mb  A-V:0.032 [0:448]
Skipping frame!
Pos:   1.0s     30f ( 0%)   0fps Trem:   4min  77mb  A-V:0.026 [0:448]
Skipping frame!
Pos:   1.1s     35f ( 0%)   0fps Trem:   3min  76mb  A-V:0.027 [15:448]
Skipping frame!
Pos:   1.5s     45f ( 0%)   0fps Trem:   4min  76mb  A-V:0.030 [12:448]
Skipping frame!
Pos:   1.6s     50f ( 0%)   0fps Trem:   3min  62mb  A-V:0.032 [12:448]
Skipping frame!
Pos:   2.0s     60f ( 0%)   0fps Trem:   4min  62mb  A-V:0.037 [10:448]
Skipping frame!
Pos:   2.1s     65f ( 0%)   0fps Trem:   2min  42mb  A-V:0.040 [10:448]
Skipping frame!
Pos:   2.8s     82f ( 0%)   0fps Trem:   2min  41mb  A-V:0.043 [71:448]
demux_mpg: 24000/1001fps progressive NTSC content detected, switching
framerate.
Pos:  27.1s    666f ( 7%)  32fps Trem:   4min  53mb  A-V:0.074 [714:448]

Same problem film with "-ss 10" to bypass first few frames. Sync is
still off 100ms

1 duplicate frame(s)!
Pos:   0.1s      3f ( 2%)   0fps Trem:   0min   1mb  A-V:0.007 [0:0]
1 duplicate frame(s)!
Pos:   0.3s     10f ( 2%)   0fps Trem:   0min   3mb  A-V:0.030 [0:0]
demux_mpg: 24000/1001fps progressive NTSC content detected, switching
framerate.Pos:   0.9s     24f ( 2%)   0fps Trem:   0min   5mb  A-V:0.087
[0:448]
Skipping frame!
Pos:  19.7s    476f ( 8%)  27fps Trem:   3min  35mb  A-V:0.070 [749:448]

Thanks in advance. 

Eric













More information about the MEncoder-users mailing list