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

Miroslav Rovis m.rovis at inet.hr
Sat May 1 15:13:33 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> 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.
You seem to be familiar with things that I am not yet. I haven't used
nice and know too little about it. Sorry! Also, some of the other
issues below, I am at this time not able to follow you. You would need
someone who is currently digitizing her/his tapes. I am not.
> ...
>
> 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.
>
I can't follow you on that one right now.
> ... 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.
No. I wouldn't. Unless I were in a hurry... I used to made (and will
probably be making again) the whole 9GB files, one per each 3hrs tape,
avi files... And if you're interested to take a look at the script I
use lately to cut out avi files (mpeg4, h264 or mpegpes and possibly
others) to proper pieces, I can post it. Oh, well, it's a short
script. I'll just post it:
-
---------------------------------------------------------------------------------------
But I probably need to explain it (advanced users, programmers, just
skip the explanation, pls.) so it can be used by beginners who might
stumble upon our conversation some day, as it's a mumbo-jumbo for
total newbies, and we like to pass our knowledge to youngsters, don't
we... May the Open Source Linux communities of the world grow and take
the world over from the bigot-ridden commercialisms which are
corrupting it! :-)
-
---------------------------------------------------------------------------------------
#!/bin/bash
# This is menc_avx_cp.sh script. Cuts out files that
# mplayer can play, like "file.avi" "file.mpg" "file.ts"
# It is run with 4 arguments.
# $1 the file, $2 the string like "birthday_party" that will be
# added to the string of the name of the file without
# extension to form the new file that is cut out from
# the file given as first argument $1
# $3 is the starting time in seconds where you cut from
# $4 is the ending time in seconds where you cut to
# variable v4 is needed and it is the -endpos for mencoder
# command in the bottom
v4=$( scale=9; echo "($4-$3)"|bc)
# these two echo lines are only for checking and can be
# deleted from the script just like all of the comments :-)
echo $3
echo $v4
# Here we only want to get the string that is the name
# of the file without extension. That way the script works on
# files regardless of their extension, just like mplayer
# plays them regardless of the extension
v1=`echo $1 | cut -d '.' -f1`
# another echo line only for checking that can be deleted
echo  "\$v1: $v1"
# variable v1_r contains the string to be used to make the
# name of the file cut out from the entire file
v1_r=${v1}_$2
# another echo line only for checking that can be deleted
echo  "\$v1_r: $v1_r"
# ext variable is a string that holds the extension part
# of the name of the file
ext=`echo $1 | cut -d '.' -f2`
echo  "\$ext: $ext"
# This is the mencoder at work, copying the video and
# audio into an avi container of that portion that
# we want in a separate file.
mencoder -noskip -mc 0 -ss $3 -endpos $v4 -oac copy -ovc copy -of avi
- -o ${v1_r}.avi $v1.$ext
-
---------------------------------------------------------------------------------------
Here it is without comments:
#!/bin/bash
v4=$( scale=9; echo "($4-$3)"|bc)
v1=`echo $1 | cut -d '.' -f1`
v1_r=${v1}_$2
ext=`echo $1 | cut -d '.' -f2`
mencoder -noskip -mc 0 -ss $3 -endpos $v4 -oac copy -ovc copy -of avi
- -o ${v1_r}.avi $v1.$ext
-
---------------------------------------------------------------------------------------
> ... ...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...
Which I cannot do with AMD64 1800MHz old Athlon boxes that I have...
But I have *time* for x264 encoding later. Looong time.
> 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?
x264
I can post my profiles that I use for the encode of most anything, and
captured VHS tapes comprised.
That way I reduce those 9GB 3hrs VHS capture to less than 2GB, no loss
in quality. But it's just from the www.mplayerhq.hu pages... Newbies
could find it useful though... Anyone need it?
>
> 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 don't know.
>
> For me, it seems that SIGSTOP is just enough. But I think it should
> be possible to insert a "sleep(5);" in my script to achieve your
> suggestion.
You might be right on this one! But I can't tell untill I try it next
time I capture VHS.
>>> I haven't seen any noticeable difference between sending
>>> SIGSTOP and leaving it running while fixing up. Have you seen a
>>> difference?
>> Yes. Noticeable difference.
>
> Well, I haven't noticed. Both variants look perfectly synchronized
> to me. Might be dependant on the hardware or the quality of the
> recording?
I can't tell at this time.
>
> AFAICS, the important point is to keep the capturing process from
> rewriting the index. For this, SIGSTOP should be enough, IMHO.
Possibly. I can't tell at this time.
>
> ...I'm planning to dive a little deeper into this issue...
Keep us posted.
>>> BTW: in reality I use a little perl wrapper.
>> Interesting... [snip]
>
> ...[snip]... If there's any interest, I'll post the newest version
> once I get it into a proper state ....[snip]
Sure!
> ... Regarding debian, I agree with you. But with ubuntu, you can
> have a full desktop install up and running within 15 minutes. IMHO,
> getting into ubuntu is not as hard as getting into gentoo. But I am
> biased, so better strip those last two paragraphs.
I was into Linux From Scratch a few years ago... And I can really make
good use of gentoo only because I have at least three boxes based on
same MBO and same/similar software RAID arrays, so the huge time for
compiling is no downtime, as the other two boxes can do the work while
one box is compiling and then I can clone that one's partition with
just network config and little else to modify onto the other boxes,
like I wrote in this article:
http://en.opensuse.org/Backup_Windows_installed_on_BIOS_RAID_with_SUSE
(I used Suse when I learned Linux, before Linux from Scratch, so I
felt I owed them and wrote that article. I also like to yell a little
at the M$ and their likes for what they've ruined and corrupted in the
computing and the internet...)
> Miro, _Very_, _Very_ BIG thanks to you! I was almost about to give
> up with all this sync problems. Without you, I would probably have
> given up and thrown those tapes into the oven...
Glad the tapes have continued to live amongst you family and friends
to whom all I wish God's blessing!
> Hey, are there any developers out there? ... this work-around
> actually works. So the next step would be to inject some debugging
> into this last fixup passage. Are there any developers out there to
> give some advice? I'd be happy to help trying to track that problem
> down. Any suggestions where to start debugging?
That'd be the point! Which I might not be able to be around to follow
happening.
I have actually taken time from other stuff that is important and only
remotely related (because it's video encoding in practice of my NGO)
even to write this reply of mine today.
And if you guys don't read from me in long weeks or months from now
you may be confident I have more troubles with the so called justice.
Actually I might even be in jail for "copyright infringement".
Here: www.CroatiaFidelis.hr Or skip to:
http://www.croatiafidelis.hr/DVD-CD/dvd_cd_90622_LG.php it's nearly
only in Croatian, but I can tell you it's all from free-to-air TV
stations and it is none of it sold, let alone sold for commercial
purposes, but my NGO only, us, between ourselves, strictly members
only, collect and watch Croatian and related very latest to
contemporary history (so it's educational purposes) as has been or is
aired freely to anyone capturing transmission signals to view it on
his TV at his home...
It's mostly about the Croatian Homeland War, about how my nation
finally got its own state... Like the Basques or the Chechen don't
have yet... And I feel great empathy for them.
And the secret doings of some law enforcers who abuse tho law might
send me to jail for four months...
Sorry if I went off the topic. I only wanted to let you know what
happened to me if you don't read from me in a longer period of time...
Josef, it's really been a pleasure corresponding with you. Sorry for
what I haven't been able to grasp of all that you gave additionally
into this workaround reindexing method for digitizing VHS tapes.
Miro

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvcKPsACgkQ5NaGZVDan0qlIgCgke6r43oUV+VAatiM+Wj8zY+v
tyEAnjAKORBilG2wBaWC2hDnrKLXSguv
=TImN
-----END PGP SIGNATURE-----



More information about the MEncoder-users mailing list