[Extractstream [MM]] Re: Avisynth (was: Using LSX to encode DVD)

Scott Alfter scott at alfter.us
Fri Jan 3 23:35:10 2003


On Tue, Dec 31, 2002 at 10:56:22AM -0600, John Douglass wrote:
> (Scott:  Please note that you should be replying to
> extractstream@lists.merlins.org instead of me directly so that
> everybody gets to hear you.  Just verify the "To:" field before you
> send.)

Grr...I didn't notice that the list doesn't include a Reply-To field in the
header.

> On Tue, 31 Dec 2002 01:03:46 -0800, Scott Alfter <scott@alfter.us>
> wrote:
> 
> >On Mon, Dec 30, 2002 at 03:53:10PM -0600, John Douglass wrote:
> >> Um, care to share your Avisynth script?  I was just starting to get
> >> into avisynth before I re-installed WinXP.
> >
> >Once you've split foo.ty into foo.m2v and foo.m2a, run foo.m2v through
> >DVD2AVI to produce foo.d2v, and run foo.m2a through LAME to produce foo.wav,
> 
> Um, why?  TMPGEnc will also run it through LAME during the transcode.
> (Why may become apparent in a moment.)

Last time I checked, TMPGEnc doesn't use LAME...mainly because LAME doesn't
do Layer 2 encoding.  LAME will do Layer 2 decoding, though, which is what I
want so that I can resample and normalize the audio with sox.  (TMPGEnc will
resample, but it doesn't normalize...and I suspect that sox does a better
job of resampling, but I don't have any proof of that assertion at this
point.)

> >something like this will load the files together: (needs mpeg2dec.dll)
> 
> You mean the version of mpeg2dec that goes with one's version of
> Avisynth, right?  I went to avisynth.org and got version 2.07.  I got
> a version of MPEG2DEC.dll, extracted to C:\Avisynth2\plugins, put in
> my script:
> LoadPlugin("c:\program files\avisynth2\plugins\MPEG2DEC.dll")

I don't think there's such a DLL in the Avisynth download, but there are
several different MPEG-2 plugins kicking around.  There's even one that
reads video streams directly (so you don't have to preprocess the file with
DVD2AVI), but I've found that it doesn't work as well.

Current versions of Avisynth (the ones that are built as Nullsoft
installers) create a directory into which you can dump all of your plugins. 
With this feature, you don't need LoadPlugin (which saves you a few seconds
every time you put a script together :-) ).

> >AudioDub(MPEG2Source("foo.d2v"),WAVSource("foo.wav"))
> 
> This associates a frameserved video (through DVD2AVI) with a synched
> audio that has been converted to 48KHz (for DVD) or 44KHz (for SVCD),
> right?

Correct.  It doesn't actually care what sample rate the audio file
uses...there's a ResampleAudio filter in Avisynth that lets you change this,
but I've usually resampled the audio by this point already.

> >Get the inverse telecine filter (another DLL) and you can apply that to
> >shows that were originally filmed:
> >InverseTelecine(40,10,15)
> 
> I'm... An unbeliever, here, as I don't see every fourth frame being a
> copy of another frame.

It's not that simple.  When video is telecined, one field from every other
frame is duplicated.  Two of the five output frames contain one field from
each of two input frames.  This URL describes how film is telecined:

http://www.geocities.com/ksong1222/telecine.htm

It follows with a page that describes what's involved in doing inverse
telecine.

> >To do non-linear editing, start by loading what you have so far into
> >VirtualDub (so you can find your cutpoints).  Create your cuts like this
> >(the frame numbers are examples):
> 
> >c1=Trim(100,200)
> 
> "c1 is that portion of foo.m2v (frameserved as foo.d2v) that has been
> muxed with foo.wav between frame 99 and 199 (as the first frame is
> numbered 0, not 1)", right?

c1 is a label, to which I assign a cut.  I could've called it something
else, but I'm lazy...I normally use just a letter and a digit.

> >c2=Trim(300,400)
> >c3=Trim(500,600)
> >etc.
> >
> >Combine them together with UnalignedSplice:
> >
> >UnalignedSplice(c1,c2,c3)
> 
> (Functions that don't appear to yield a value to a variable instead
> assign a value to the builtin, understood variable, "last".)

You can assign anything to a label.  All Avisynth functions can take a label
as their first parameter.  If you leave out the label, the output of the
previous function is assumed to be the input of the current function.  You
can nest functions, but using one function per line is more readable.

> >> >Ouch.  With settings similar to the OP, I can encode the typical "1-hour"
> >> >show (sans ads) in somewhere around 3 hours.
> 
> Are you saying that, now that I have foo.avs loaded in TMPGEnc, and
> although the picture in TMPGEnc looks to be 720x480, I still need to
> push the TMPGEnc "Start" button to transcode the show to 720x480 and
> save it to an mpg file?  And that by letting avisynth do all this
> editing and resizing TMPGEnc has little else to do, so the time
> TMPGEnc runs is reduced by half?  This I gotta try! 

I'm not sure if doing the editing/processing in Avisynth will necessarily
cut your encoding time.  I suspect that Avisynth is more efficient at
editing and processing than TMPGEnc, though, given that Avisynth's job is to
edit and process video and audio and TMPGEnc's primary job is to encode
video.  Avisynth is also much more flexible WRT the kinds of things you can
do with it.  (For instance, I created a script at work that superimposes two
video clips onto a static background.  That took a while to figure out, but
it's pretty slick.)

> >> You have this on your website?
> 
> >IIRC, the TMPGEnc settings on my TiVo-to-SVCD page are the ones I'm
> >currently using.
> >http://salfter.dyndns.org
> 
> Yeahbut, your website talks about a whole lot of VirtualDub stuff
> that, with avisynth, just ain't necessary, right?

My website (well, my TiVo-to-SVCD page, anyway) needs an update. :-)

  _/_   Scott Alfter
 / v \  salfter@salfter.dyndns.org
(IIGS(  http://salfter.dyndns.org   Top-posting!
 \_^_/  pkill -9 /bin/laden         >What is the most annoying thing on Usenet?




More information about the Extractstream mailing list