[MPlayer-users] mencoder mpeg2->divx audio delay question

Steven M. Schultz sms at 2BSD.COM
Thu Aug 15 19:57:01 CEST 2002


Hi!

	I'm having difficulty encoding from YUV4MPEG2 (from a DV file)
	to divx.   The audio races ahead of the video (the A-V column
	gets very large very quickly).

	This is not the DV in avi problem because I am feeding mencoder
	YUV4MPEG2 data (from lav2yuv) and MP3 audio (from lame).

	Here's the script being used:

-----------
#!/bin/sh

N=coalb

lav2wav $N.eli | lame -b 128 - $N.mp3

lav2yuv $N.eli | \
	mencoder -vop scale=480:480 -sws 2 \
	-oac copy -audiofile $N.mp3 \
	-ovc lavc \
	-lavcopts vcodec=mpeg4:vbitrate=2500:vhq:vmax_b_frames=4:vpass=1 \
	-o $N.divx -- -

lav2yuv $N.eli | \
	mencoder -vop scale=480:480 -sws 2 \
	-oac copy -audiofile $N.mp3 \
	-ovc lavc \
	-lavcopts vcodec=mpeg4:vbitrate=2500:vhq:vmax_b_frames=4:vpass=2 \
	-o $N.divx -- -
-----------

	Playing the output file:

Playing coalb.divx
Detected AVI file format!
VIDEO:  [DIVX]  480x480  24bpp  29.97 fps  2632.3 kbps (321.3 kbyte/s)
Detected audio codec: [mp3] afm:1 (mp3lib MPEG layer-2, layer-3)
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, sfmt: 0x10 (2 bps), ratio: 16000->192000 (128.0 kbit)
vo: X11 running at 1600x1200 with depth 24 and 32 bpp (":0.0" => local display)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Detected video codec: [ffodivx] vfm:5 (FFmpeg MPEG-4)
libavcodec: CPU flags: mmx mmxext sse
==========================================================================
AO: [oss] 48000Hz 2ch Signed 16-bit (Little-Endian)
Start playing...
A:  27.6 V:   0.0 A-V: 27.543 ct:  0.000    1/  1   0%  0%  0.0% 0 0 0%
A:  27.6 V:   0.1 A-V: 27.538 ct:  0.003    2/  2   0%  0%  0.0% 0 0 0%
A:  36.8 V:   0.1 A-V: 36.726 ct:  0.007    3/  3   0%  0%  0.0% 0 0 0%
VDec: vo config request - 480 x 480 (preferred csp: Planar YV12)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 480x480 => 480x480 Planar YV12
Disabling DPMS
A:  46.0 V:   0.1 A-V: 45.916 ct:  0.010    4/  4   0%  0%  0.0% 0 0 0%
A:  64.5 V:   0.2 A-V: 64.307 ct:  0.013    5/  5   0%  0%  0.0% 0 0 0%
A:  73.7 V:   0.2 A-V: 73.495 ct:  0.017    6/  6   0%  0%  0.0% 0 0 0%
A:  82.9 V:   0.2 A-V: 82.683 ct:  0.020    7/  7   0%  0%  0.0% 0 0 0%
A:  92.1 V:   0.3 A-V: 91.872 ct:  0.023    8/  8   0%  0%  0.0% 0 0 0%
A: 110.6 V:   0.3 A-V:110.253 ct:  0.027    9/  9   0%  0%  0.0% 0 0 0%
A: 119.8 V:   0.3 A-V:119.441 ct:  0.030   10/ 10   0%  0%  0.0% 0 0 0%
A: 138.2 V:   0.4 A-V:137.822 ct:  0.033   11/ 11   0%  0%  0.0% 0 0 0%
A: 147.4 V:   0.4 A-V:147.011 ct:  0.037   12/ 12   0%  0%  0.0% 0 0 0%
A: 147.4 V:   0.4 A-V:147.007 ct:  0.040   13/ 13   0%  0%  0.0% 0 0 0%
	...

	Wow, see the A-V column?

	The video plays back at what appears to be the correct rate but the
	audio is much too fast.

	During the encoding everything looks fine - the A-V numbers look
	good:

   INFO: [lav2yuv] DV frame 13649   len 120000  0mb  A-V:0.057 [2480:128]
   INFO: [lav2yuv] DV frame 13650   len 120000  0mb  A-V:0.060 [2480:128]
   INFO: [lav2yuv] DV frame 13651   len 120000  0mb  A-V:0.063 [2480:128]
   INFO: [lav2yuv] DV frame 13652   len 120000  0mb  A-V:0.067 [2480:128]

	Where might problem be?   In the YUV4MPEG2 handling (DV data is
	bottom field first but that shouldn't make a difference)?   48k audio?

	Has any one else experimented with encoding DV data (from either a
	camcorder or a Canopus ADVC-100 analog->DV converter)?    No trouble
	producing MPEG-2 (SVCD or DVD format) files.   And if I take one of
	those MPEG files thru mencoder the .divx file is correct.

	Steven Schultz
	sms at 2bsd.com




More information about the MPlayer-users mailing list