[MEncoder-users] composite input a/v sync issue

Miroslav Rovis m.rovis at inet.hr
Thu Nov 12 15:45:48 CET 2009


After lots more of trials, I might be able to make a good-sync digitized
good-quality file of a whole VHS in one go on my beloved Linux (it costs
me dearly in time and nerves, but I think it is one of the best things
the world has ever had and will ever have in the whole of computing).
But...
But, if I put my trust solely in the command line options, then I beg
anyone who knows the true one missing options to tell me. As...
As, the very moment the -endpos time that I gave it is over, and the
mencoder wraps it up similar to:
...
Pos:2025.3s  50490f ( 0%) 24.93fps Trem:   0min   0mb  A-V:0.000 [16636:140]
Skipping frame!
Pos:2025.6s  50498f ( 0%) 24.93fps Trem:   0min   0mb  A-V:0.000 [16635:140]
1 duplicate frame(s)!
^CPos:2026.1s  50511f ( 0%) 24.93fps Trem:   0min   0mb  A-V:0.000
[16632:140]
Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 4:3.

Video stream: 16632.957 kbit/s  (2079119 B/s)  size: 4212545923 bytes
2026.120 secs  50511 frames

Audio stream:  140.377 kbit/s  (17547 B/s)  size: 35551824 bytes
2026.080 secs
v4l2: 50586 frames successfully processed, 96 frames dropped.
mybox #

(or, for that matter, if I ended the processing by issuing an Ctrl-C on
the command line)...
The very moment mencoder obbediently wraps it all up, the sync is... lost.
If the VHS tape has any (or many, which then makes the de-sync grow to
as huge and as messed up as 5 or more seconds) of those intervals where
the tape was recording without any input from SCART, or from composite
or any other input source *on the VHS recorder* that was taping that
tape years and years back, when many of us didn't have any better than
VHS for taping our favorite TV shows or whatever... Those black
intervals with possibly some white stripes or streaks and snowy noise or
other nuissance...
If, that is, the VHS tape has any of those, than that wrapping it up by
the nice program mencoder, makes the sync messed up.
I can, if someone needs it, paste my trial commands somewhere, but they
really are numerous, and basically it's what you can find so far in this
thread that you are reading in this mencoder-users list, so be spared.
Again, if the VHS tape has any of those intervals, the wrapping it up by
 mencoder makes the sync messed up.
If it is taped normally all over, meaning the source was there for the
VHS recorder and it wasn't taping without a source (the blue is also OK,
I think), then there are other options to make a synced digitized file
of the VHS cassette with mencoder, I believe.
But I'll stick to the following.
I discovered that this works for me:
 mencoder tv:// -tv
input=1:driver=v4l2:device=/dev/video0:normid=3:input=1:alsa:adevice=hw.0:audiorate=48000:amode=1:width=768:height=576
-ovc lavc -lavcopts
vcodec=mpeg4:autoaspect:vqscale=4:vb_strategy=1:b_sensitivity=10:mbd=0:turbo
-oac mp3lame -lameopts cbr:preset=standard -mc 100 -o VHS_no032_`date
+%H%M%S`.avi
No -endpos in the first place (else see above).
No -noskip
No -vf harddup
No -vf softskip
Only -mc 100
Firing up in another konsole:
mplayer -forceidx VHS_no032_HHMMSS.avi
(where HHMMSS is whatever `date +%H%M%S` gave at the time the command
further above was issued)
I am able to see if the capturing is proceeding well.
But, since I can't let the mencoder program wrap it up (else see above),
here's what I do:
mencoder -forceidx VHS_no032_HHMMSS.avi -ovc copy -oac copy -o
VHS_no032_HHMMSS_`date +%H%M%S`.avi
Of course, I do that when I see that I have captured what I wanted to,
and I believe, but don't know yet, that it can be the whole VHS tape
just fine.
Whatever the mencoder does when wrapping it up is what I would much like
to know, if it is within the reach of my intellectual grasp, which it
may not be, since I've never had time, although it would've been great,
for programming...
(loud:) Because it desyncs it all, that wrapping up!
But I can live without knowing that much, of course.
Luckily, the file that I get with the latter command above, and I'll
repeat it:
mencoder -forceidx VHS_no032_HHMMSS.avi -ovc copy -oac copy -o
VHS_no032_134729_`date +%H%M%S`.avi
gives me the desired well-synced captured output.
It just gave me fine 40 minutes while I was writing this.
And if it wouldn't give me the whole next 3h or 4h VHS capture in one
file that I will later be able to archive with:
mencoder $1.avi -o $1_`date +%H%M%S`.avi -ss 0 -ovc x264 \
-x264encopts turbo:crf=$2:frameref=5:bframes=1:\
me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300
\
-vf harddup \
-oac faac -faacopts br=192:mpeg=4:object=2 -channels 2 -srate 48000 \
on a DVD with some room left yet.
And if it wouldn't give me that, you'll read more of me still...
I do have one issue left, even if the above works.
And that is: it's at the top of my box' power that this processing
costs, performance-wise.
So if I don't background the (above):
mencoder -forceidx VHS_no032_HHMMSS.avi -ovc ...
indexing of the captured output, before mencoder wraps it up...
If I don't background the above task every 500 or so seconds, the system
chokes and goes thrashing, and I get buffer underuns and lose data...
But that is a minor issue in comparison with all that I've grappled with
so far in this thread...
Wow, that was long talking.
I hope this helps someone else as well.
Thanks if anyone gives me a "proper wrapping up" option that let's the
sync be.


More information about the MEncoder-users mailing list