PDA

View Full Version : How to trim one frame from ends of multiple concats?


Trixter
24th October 2006, 01:57
I'm assembling a 3 hour video using avisynth, and this is the syntax I'm using:


AviSource("NTSC_megademo.avi") + \
AviSource("NTSC_MentalHangover.avi") + \
AviSource("NTSC_Enigma.avi") + \
AviSource("NTSC_Voyage.avi") + \
AviSource("NTSC_Hardwired.avi") + \
AviSource("NTSC_HumanTarget.avi") + \


...etc., for a total of 30 clips joined together. However, I just learned that I need to trim the last frame from only six of the 30 clips. The lengths of the clips are not known (meaning, I don't have the exact length in frames written down for all the clips, but I would assume that's something Avisynth can gather).

I know which clips need the last frame trimmed off, but I can't get it to work -- I've been messing around with trim, like "AviSource("NTSC_Voyage.avi").trim()", but I'm not getting the results I was expecting -- for example, "0" is a shortcut to "end of file" but is there some way to tell it "length-1" or something?

Can anyone advise me on the proper way to accomplish this?

foxyshadis
24th October 2006, 02:17
There's trim2 from stickboy, or you can pull those clips out and use a variable:

a = Avisource("x")
... + \
a.trim(0,a.framecount-2) + \
...

But trim2 would be a lot cleaner.

Trixter
24th October 2006, 03:57
trim2 sounds like exactly what I needed, thanks! But how would I use it? Is it enough to just include .trim2(0,-1) at the end of each avisource, or do I need to assign a variable to each clip? If the latter, how would I concatenate them together -- is it as simple as a + b + c, etc.?

stickboy
24th October 2006, 04:07
trim2 sounds like exactly what I needed, thanks! But how would I use it? Is it enough to just include .trim2(0,-1) at the end of each avisource,That'd be fine.
or do I need to assign a variable to each clip? If the latter, how would I concatenate them together -- is it as simple as a + b + c, etc.?That'd work too.

Trixter
24th October 2006, 06:58
While I won't know for sure until this 7-hour encode is finished, I think this did the trick. Thanks so much, this saves me another 5 days of re-rendering (don't ask) :-)

stickboy
24th October 2006, 07:05
It's usually a good idea to preview the cuts/splices first (possibly without any other filters) in VirtualDub without going through the rendering process.

Trixter
25th October 2006, 03:56
That part has already been done; I just didn't want to waste 2 or more hours re-saving the files that needed a single frame trimmed (these .avis average 11G in size).