[MEncoder-users] A/V sync problems when digitizing old VHS tapes with mencoder

Josef Wolf jw at raven.inka.de
Fri Apr 30 20:54:02 CEST 2010


On Thu, Apr 29, 2010 at 01:44:04PM +0200, Miroslav Rovis wrote:

> But did you get the sync OK?

Now I have some more infos on my findings, and along with them more questions
;-)

First of all, I see an effect that is really surprising to me: when I use
"nice -n -XX" to give the capturing process a higher priority, mencoder's
CPU usage almost doubles. It doesn't matter whether there are other processes
running or not. After a while, mencoder starts complaining about video buffer
overruns. This doesn't happen if I avoid increasing priority. Very strange.

So now to the sync issue: Sync looks OK with this method, AFAICS.

BUT, there are drawbacks, which also seem to depend on which codec is used.

With x264, for example, seeking in the resulting stream gives the effect as
if the wrong i-frame is used as a reference to start playing at the new
position. So after the jump, video is totally garbled and gets better slowly
during some 5..10 seconds. Imagine replacing an i-frame by some arbitrary
picture and you know what I mean.

With lavc-mpeg4 (as you suggested), it looks much better.

But then there's another aspect to consider: On my tapes, there are lots of
independent recordings. Birthdays, holidays, weddings, such family events,
you know. Many of them on every tape. So I'd like to cut them apart while
I'm at this digitizig process.

The drawback of lavc-mpeg4 is that you can cut only at granularity of 10
seconds (or whatever value you give to the keyint option). To get a finer
grained cut, I decided to try a lossless codec at capture time. So
currently a capture is running with lavc-ljpeg, which gives me about 400MB
per minute. The plan is to do the lossy encode after the cut. With this
strategy, I can throw much more CPU at the problem without worrying about
realtime issues. I hope to get better quality while using fewer bits at the
expense of more CPU.

Nevertheless, I do deinterlace and crop at capture time. So currently I use

  ionice -c1 mencoder \
  -tv driver=v4l2:input=1:buffersize=100:normid=4:forceaudio:alsa=1:adevice=hw.0,0,0:audiorate=44100:amode=1:width=768:height=576 \
  -mc 0 -vf yadif=0,crop=752:560:8:8,softskip,harddup \
  -oac mp3lame -lameopts preset=standard:mode=2 \
  -ovc lavc -lavcopts vcodec=ljpeg \
  infile -o outfile

for the capture.

I have no clue yet how to do the final encode after the cut. I'd like to
get best quality I can. OTOH, VHS is very limited quality in the first place
anyway, so I'd like to avoid wasting bits. I'd like to trade CPU cycles
against bits+quality. Any suggestions?

BTW: how do I know which normid is the correct one for my composite-input?
     Where can I find an overview of all those PAL-XXX norms?


More information about the MEncoder-users mailing list