[MEncoder-users] A/V sync problems when digitizing old VHS tapes with mencoder
Josef Wolf
jw at raven.inka.de
Thu Apr 29 20:39:48 CEST 2010
On Thu, Apr 29, 2010 at 01:44:04PM +0200, Miroslav Rovis wrote:
Thanks for your help and your patience, Miroslav!
> (Problem with configure script)
I got it built in the meantime...
> But did you get the sync OK?
I did only a short check, but at first glance, it looks much, much better!
But I still don't really get it. In your other post you write:
> > while it is halted. Still bad sync.
> You seem to be issuing the reindexing command while the menocder is
> halted. No. That is completely useless.
> mencoder needs to be running in it's own other konsole.
> You need to start the "mencoder -forceidx ..." command *before* you halt
> it.
I don't understand this. I send SIGSTOP, do the fixup, and finally kill
the capturing process. Should the capturing process be running all the
time and eating CPU and I/O instead?
I run the capturing process with "nice -n -20 ionice -c1" to avoid
loosing any frames. If I don't stop or kill, the fixup process will
run forever...
I haven't seen any noticeable difference between sending SIGSTOP and
leaving it running while fixing up. Have you seen a difference?
BTW: in reality I use a little perl wrapper. With this, I don't need to
sit there and wait for the moment when I have to start the fixup.
#! /usr/bin/perl
use strict;
use warnings;
use POSIX;
umask 022;
my ($outfile, $length) = @ARGV;
my $tmpfile="$outfile-$$.avi";
if (my $pid=fork) {
sleep &seconds ($length);
kill "STOP", $pid;
system("ionice -c3 nice -n 40 mencoder -forceidx -oac copy -ovc copy $tmpfile -o $outfile.avi");
unlink "$tmpfile";
kill "KILL", $pid;
wait;
} else {
exec "mencoder tv:// -profile mpeg4_capt -profile mpeg4_capt_MP3 -o $tmpfile";
exit;
}
sub seconds {
my ($timespec) = @_;
$timespec .= ".000" unless $timespec=~/\./;
my @t = reverse split (/[:.]/, $timespec);
push @t, (0,0,0,0);
$t[0]/1000 + $t[1] + $t[2]*60 + $t[3]*3600;
}
> If you didn't it's like painting the walls while bricks are not all
> built in the wall yet...
:-)
> That wouldn't fix your sync anyway... I told you. That'd only make it
> all a little more perfect yet... Leave it for now...
Already done, thanks :-)
> Besides, I'm just not that good with compiling things, apart from that
> hacker patch on the run that I figured out there... Sorry!
It's not _that_ hard on debian/ubuntu:
$ sudo apt-get -y -q build-dep mencoder
$ apt-get source mencoder
$ emacs stream/tvi_v4l2.c # change MAX_SKEW_DELTA to 0.02
$ cd mplayer-version-number && dpkg-buildpackage -tc -d
$ sudo dpkg -i $pkgname
Of course, if you want bleeding-edge, its more complicated
> So, again: did the "... -forceidx ..." command get you the sync right?
> If it didn't, I don't know what could, but the MAX_SKEW_DELTA thing is
> irrelevant...
As I wrote above, looks much better now. I'll have to do some more testing,
though...
But one problem still exists: when I use mencoder on the fixed file (e.g.
if I want to cut out pieces), sync get lost again.
More information about the MEncoder-users
mailing list