[MEncoder-users] Audio sync issues

Pierre Grimaud pieroxy at gmail.com
Fri Feb 2 23:03:45 CET 2007


I am trying to encode mkv videos (H264/AC3) to XviD AVI, trying to preserve
the audio track. Whenever I put '-oac copy' in there I have a bunch of lines
looking like that:

   Pos:   0.0s      3f ( 0%)  0.00fps Trem:   0min   0mb  A-V:-0.008 [0:0]
   1 duplicate frame(s)!
   Pos:   0.2s      5f ( 0%)  0.00fps Trem:   0min   0mb  A-V:-0.017 [0:0]
   1 duplicate frame(s)!
   Pos:   0.9s     22f ( 0%) 19.40fps Trem:   0min   0mb  A-V:-0.088 [0:128]
   1 duplicate frame(s)!
   Pos:   1.4s     32f ( 0%) 19.56fps Trem:   0min   0mb  A-V:-0.088[1735:128]
   1 duplicate frame(s)!
   Pos:   1.8s     42f ( 0%) 16.98fps Trem:   0min   0mb  A-V:-0.088[1884:128]
   1 duplicate frame(s)!
   Pos:   2.2s     52f ( 0%) 15.01fps Trem:   0min   0mb  A-V:-0.088[2098:128]
   1 duplicate frame(s)!
   Pos:   2.7s     62f ( 0%) 14.46fps Trem:   0min   0mb  A-V:-0.088[2200:128]
   1 duplicate frame(s)!
   Pos:   3.1s     72f ( 0%) 14.04fps Trem:   0min   0mb  A-V:-0.088[2433:128]
   1 duplicate frame(s)!

Which is of course bad (is it ?). When I play the file, usually the audio
will get there for a few secs and then will get broken.
I tried a '-mc 0' which does make this message disappear, but then I get the
following after a few minutes of encoding:

   Pos: 196.4s   4710f ( 4%) 10.17fps Trem: 177min 1802mb  A-V:0.000[3080:128]
   Too many audio packets in the buffer: (4097 in 6292992 bytes).
   Maybe you are playing a non-interleaved stream/file or the codec failed?
   For AVI files, try to force non-interleaved mode with the -ni option.

I tried -noskip but the messages are still there (around one for each 10
frames)... "-vf harddup" also shows the same problem (on playback and
encoding)

If I specify "-oac mp3lame", everything works fine (a few duplicate frames
at first and then everything settles down) but in the resulting video, the
audio is out of sync. Anyways, I'd like to be able to keep the original
soundtrack.

Thanks for any help, much appreciated.
-- 
pieroxy



Note: I join one command-line and its output there:
===============================
mencoder -o Microcosmos.avi -ovc xvid -oac copy
/media/spare/Video/Microcosmos.mkv -xvidencopts
bitrate=3000:me_quality=0:vhq=0 -ofps 24000/1001
MEncoder 2:0.99+1.0pre8-0ubuntu8 (C) 2000-2006 MPlayer Team
CPU: AMD Sempron(tm) 2500+ (Family: 6, Model: 8, Stepping: 1)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0x16b85337
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang eng
[mkv] Will play video track 1
[mkv] Will play audio track 2
Matroska file format detected.
VIDEO:  [avc1]  1280x720  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:31  fourcc:0x31637661  size:1280x720  fps:23.98  ftime:=0.0417
xvid: using library version 1.1.0 (build xvid-1.1.0)
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
audiocodec: framecopy (format=2000 chans=6 rate=48000 bits=16 B/s=16000
sample-1536)
VDec: vo config request - 1280 x 720 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: XviD (1280x720 fourcc=44495658 [XVID])
xvid: par=0/0 (vga11), displayed=1280x720, sampled=1280x720
xvid: CBR Rate Control -- bitrate=3000kbit/s
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.000s.
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.000s.
Pos:   0.0s      3f ( 0%)  0.00fps Trem:   0min   0mb  A-V:-0.008 [0:0]
1 duplicate frame(s)!
Pos:   0.2s      5f ( 0%)  0.00fps Trem:   0min   0mb  A-V:-0.017 [0:0]
1 duplicate frame(s)!
Pos:   0.9s     22f ( 0%) 19.40fps Trem:   0min   0mb  A-V:-0.088 [0:128]
1 duplicate frame(s)!
Pos:   1.4s     32f ( 0%) 19.56fps Trem:   0min   0mb  A-V:-0.088 [1735:128]
1 duplicate frame(s)!
Pos:   1.8s     42f ( 0%) 16.98fps Trem:   0min   0mb  A-V:-0.088 [1884:128]
1 duplicate frame(s)!
Pos:   2.3s     52f ( 0%) 15.99fps Trem:   0min   0mb  A-V:-0.088 [2022:128]
1 duplicate frame(s)!
Pos:   2.4s     54f ( 0%) 15.82fps Trem:   0min   0mb  A-V:-0.054 [2006:128]



And another one:
===============================
mencoder -o Microcosmos.avi -ovc xvid -oac copy
/media/spare/Video/Microcosmos.mkv -xvidencopts
bitrate=3000:me_quality=0:vhq=0 -ofps 24000/1001 -mc 0
MEncoder 2:0.99+1.0pre8-0ubuntu8 (C) 2000-2006 MPlayer Team
CPU: AMD Sempron(tm) 2500+ (Family: 6, Model: 8, Stepping: 1)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0x16b85337
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang eng
[mkv] Will play video track 1
[mkv] Will play audio track 2
Matroska file format detected.
VIDEO:  [avc1]  1280x720  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:31  fourcc:0x31637661  size:1280x720  fps:23.98  ftime:=0.0417
xvid: using library version 1.1.0 (build xvid-1.1.0)
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
audiocodec: framecopy (format=2000 chans=6 rate=48000 bits=16 B/s=16000
sample-1536)
VDec: vo config request - 1280 x 720 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: XviD (1280x720 fourcc=44495658 [XVID])
xvid: par=0/0 (vga11), displayed=1280x720, sampled=1280x720
xvid: CBR Rate Control -- bitrate=3000kbit/s
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.000s.
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.000s.
Pos:   0.0s      3f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.2s      5f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos: 196.4s   4710f ( 4%)  9.59fps Trem: 188min 1802mb  A-V:0.000 [3079:128]
Too many audio packets in the buffer: (4097 in 6292992 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.

Flushing video frames
Writing index...
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.000s.

Video stream: 3079.551 kbit/s  (384943 B/s)  size: 75620783 bytes
196.446secs  4710 frames

Audio stream:  128.000 kbit/s  (15999 B/s)  size: 3156480 bytes  197.280secs



More information about the MEncoder-users mailing list