[MPlayer-users] A-V sync with mencoder/mplayer

Ken Bass daytooner at gmail.com
Thu Dec 10 00:14:51 CET 2009


Hi all, newbie here - so please bear with me :-)

In short, I am trying to capture video from vhs, via a tv capture card. But
the A-V is out of sync - audio lags video. Actually, it becomes
progresssively worse as the recording goes on.

The details:

PC: dual Xeon 3Ghz (that's 4 CPUs), with 2G memory.
Fedora 11, with stock apps, codecs, etc (from repos - no rebuilds).
kernel 2.6.30-9-96
Pinnacle PCTV HD800i w/ Conexant cx23880 chipset.
driver loaded: cx8800
Sound Card: SB Live (EMU10K1) - driver snd_emu10k1

I have tried both ALSA and OSS. ALSA seems to work the best, but I keep
getting XRUNS.

Also, if I just capture raw audio/video, then I also get better sync (almost
perfect). But my i/o and disk drives can't seem to handle that much of a
stream before the video buffer fills up and audio frames start dropping.

Since I am using V4L2 to access the capture card, I am using this tv option
to mencoder:

-tv "input=1:alsa:adevice=hw.1,0:amode=1:immediatemode=0:mjpeg:decimation=1"

For OSS, I remove 'alsa', and change the adevice to '/dev/dsp1'.

The entire mencoder line (for raw dump) is:

mencoder -tv "{options above}" -oac copy -ovc copy -vf harddup -idx -noskip
-mc 0 -ni -o ofile.avi tv://

I have tried using mp3lame and lavc for audio encoders, and lavc for video,
but that just seems to make the de-syncing to happen faster.

Here is the output of mencoder when I run it:

[ken at Bugs root]$ mencoder -tv
"input=1:alsa:adevice=hw.1,0:amode=1:immediatemode=0:mjpeg:decimation=1"
-oac copy  -ovc copy -vf harddup -noskip -idx -ni -mc 0 -o
/xfs/vhs-raw-test.avi   tv://

MEncoder SVN-r29701-4.4.1 (C) 2000-2009 MPlayer Team
success: format: 9  data: 0x0 - 0x0
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski at zpr.uni-koeln.de>
 comment: first try, more to come ;-)
Selected device: Pinnacle PCTV HD 800i
 Tuner cap:
 Tuner rxs:
 Capabilites:  video capture  VBI capture device  tuner  read/write
streaming
 supported norms: 0 = NTSC-M; 1 = NTSC-M-JP; 2 = NTSC-443; 3 = PAL-BG; 4 =
PAL-I; 5 = PAL-DK; 6 = PAL-M; 7 = PAL-N; 8 = PAL-Nc; 9 = PAL-60; 10 =
SECAM-B; 11 = SECAM-G; 12 = SECAM-H; 13 = SECAM-DK; 14 = SECAM-L;
 inputs: 0 = Television; 1 = Composite1; 2 = S-Video;
 Current input: 1
 Current format: BGR24
v4l2: current audio mode is : STEREO
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
  MJP: width 704 height 576
[V] filefmt:9  fourcc:0x59565955  size:704x480  fps:29.970  ftime:=0.0334
videocodec: framecopy (704x480 24bpp fourcc=59565955)
audiocodec: framecopy (format=1 chans=2 rate=48000 bits=16 B/s=192000
sample-4)
Forcing audio preload to 0, max pts correction to 0.
Writing header...1f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
ODML: Aspect information not (yet?) available or unspecified, not writing
vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing
vprp header.
Writing index...  46f ( 0%) 22.19fps Trem:   0min   0mb  A-V:0.000
[162039:1536]
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing
vprp header.
. . . . . . . . . . (snip out alot of the following repeated lines) . . . .
. .

video buffer full - dropping frame

too bad - dropping audio frame !

too bad - dropping audio frame !

too bad - dropping audio frame !

too bad - dropping audio frame !
Pos: 109.5s   3281f ( 0%) 23.37fps Trem:   0min   0mb  A-V:0.000
[162039:1536]
too bad - dropping audio frame !
Writing index...3436f ( 0%) 23.83fps Trem:   0min   0mb  A-V:0.000
[162039:1536]
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing
vprp header.

Video stream: 162039.560 kbit/s  (20254945 B/s)  size: 2322186240 bytes
114.648 secs  3436 frames

Audio stream: 1536.000 kbit/s  (192000 B/s)  size: 22080000 bytes  115.000
secs
v4l2: 4295 frames successfully processed, 29 frames dropped.

I have tried many permutations of alsa vs oss, different output coders, etc.
But no luck.

I have been fighting with this for a long time. So any help/pointers will be
greatly appreciated.

TIA

ken


More information about the MPlayer-users mailing list