A/V sync problems when digitizing old VHS tapes with mencoder
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 (Problem with configure script) But did you get the sync OK? If you didn't it's like painting the walls while bricks are not all built in the wall yet...
----------------------------------------------------------------------
Message: 1 Date: Thu, 29 Apr 2010 08:37:41 +0200 From: Josef Wolf <jw@raven.inka.de> Subject: [MEncoder-users] Problem with configure script To: mencoder-users@mplayerhq.hu Message-ID: <20100429063741.GF15971@raven.wolf.lan> Content-Type: text/plain; charset=us-ascii
Hello,
I am trying to recompile mencoder to adjust MAX_SKEW_DELTA in stream/tvi_v4l2.c as suggested in
http://lists.mplayerhq.hu/pipermail/mplayer-users/2010-April/079686.html
but the configure script bails out with ... BTW: Will MAX_SKEW_DELTA be changed in some future release of mencoder? 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... Besides, I'm just not that good with compiling things, apart from that hacker patch on the run that I figured out there... Sorry! 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... Cheers! Miro
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvZcQMACgkQ5NaGZVDan0p/UQCgku0ikHJGGCSyX/y5syw9bzoe hvcAnRJEqKPUIDQhIqtGm2HuX1Ljo0UO =T+F0 -----END PGP SIGNATURE-----
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.
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?
Hi, On Fri, Apr 30, 2010 at 20:54:02 +0200, Josef Wolf wrote:
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?
I use v4l-info from the xawtv package. Example output from my TV card is attached. See the section "standards". That should help. Moritz
participants (3)
-
Josef Wolf -
Miroslav Rovis -
Moritz Barsnick