Log in

View Full Version : Newbie needs help, multiple clips and can't get it working...


Jeff D
6th March 2003, 09:50
I'm new, I've got experience with avisynth, but only basic. I could always do what I wanted, but not this time...

I've got three captured video clips from a laserdisc movie, 2 sides in clip 0, 2 sides in clip 2 and 1 side in clip 3. I want to convert back to the 24fps source.

I've been trying all night and getting close, but can't quite get it working.

So, I started with a test, and for the test I'll just be taking three segements from the first capture file. The first capture file will be telecined, decimated, cropped, trimmed, tweaked, resized, borders will be added and set the frame rate.

Based on samples found here I went with the following:

LoadPlugin("C:\avsplugs\2.5\decomb406b6\Decomb.dll")

video1=AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop (0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)

video=video1.trim(3555,6755)+video1.trim(48734,50615)+video1.trim(79504,82992)

#target video width
tx = 720
ty = 378

topborder = (((480-ty)/2)/16)*16 # top letterboxing rect, rounded to 16 pixels
BicubicResize(video, tx, ty )
AddBorders(video, 0,topborder,0,480 - (topborder + ty) ) # add black letterbox bars to 720 x 480 frame size

#AssumeFPS(video, 23.976 )


other attempts include:

LoadPlugin("C:\avsplugs\2.5\decomb406b6\Decomb.dll")

video1=AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5)

video=video1.trim(3555,6755)+video1.trim(48734,50615)+video1.trim(79504,82992)
Crop (video, 0, 103, 720, 276)
Tweak(video,0.0, 0.80, 1.0, .92)

or

LoadPlugin("C:\avsplugs\2.5\decomb406b6\Decomb.dll")

video1=AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5)
Crop (video1, 0, 103, 720, 276)
Tweak(video1, 0.0, 0.80, 1.0, .92)

video=video1.trim(3555,6755)+video1.trim(48734,50615)+video1.trim(79504,82992)


Now, I've also tried to split commands up, but I can't get that working either. Avisynth just stops paying attention to the script. I've added test "return" lines that seem to never get executed.

This will only get a bit more complicate when I try to deal with my source being combined from three cap files with 5 trim segments.

The source format was based off a sample provided elsewhere in the forum. I would think the best way to do this would be:
AVIsource with the telecine and decimate
combine all the telecined and decimated clips into one
crop the one combined stream
do the resize, and the border
and finally do the tweak, tweak can before the crop to, but what does it matter?

How should I be formatting this? Is the mixing of "sream.function()" and "function(stream)" a bad idea? It seems to understand. =)

I've checked the command parameters, and I believe all the filters work in YUY2 colorspace. My avisynth is 2.50 beta dated on my birthday this year (1/28). Capture files are avi, huffyuv yuy2 format.

Wilbert
6th March 2003, 10:47
The syntax of your script is not good, for example:

LoadPlugin("C:\avsplugs\2.5\decomb406b6\Decomb.dll")

video1=AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop (0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)
video=video1.trim(3555,6755)+video1.trim(48734,50615)+video1.trim(79504,82992)

#target video width
tx = 720
ty = 378

topborder = (((480-ty)/2)/16)*16
BicubicResize(video, tx, ty )
AddBorders(video, 0,topborder,0,480 - (topborder + ty) )

The last line adds borders to "video" (i.e. the clip defined in the second line). What you want is that it is applied after resizing, thus your script must be:

LoadPlugin("C:\avsplugs\2.5\decomb406b6\Decomb.dll")

video1=AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop (0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)
video=video1.trim(3555,6755)+video1.trim(48734,50615)+video1.trim(79504,82992)

#target video width
tx = 720
ty = 378

topborder = (((480-ty)/2)/16)*16
video2=BicubicResize(video, tx, ty )
AddBorders(video2, 0,topborder,0,480 - (topborder + ty) )

Your other attempts have the same problem (both in the tweak line).

Jeff D
7th March 2003, 00:19
Wilbert, thanks, that makes a lot of sense!

like I said before I had a good "basic" understanding of the scripting language, but this was one point I was unclear on.

I was also having problems with other functions like subtitle and others.

Since return values aren't part of the call descriptions, how can one decide if there will be a resultant clip different than the one going in? I was under the belief that if I passed "video" off to the crop function, that "video" would be modified, same for tweak and others.

I'm sure there must be a rule to figure out which functions have an output stream that is different from the input stream. Is that documented anywhere? Or should I ALWAYS take the result from a function and put that into a new variable for future use?

Thanks!

Guest
7th March 2003, 00:47
If you do not assign to a variable, a default internal variable is used. If you do not pass a clip as a parameter, that same internal variable is used. IIRC, the name of the variable is 'last', but check the documentation to be sure. These conventions allow you to make pipelines without having to define explicit variables. But you can always override them as required by specifying input or output clip variables.

Jeff D
7th March 2003, 01:20
Thanks Don, that was acutally the assumption I was working on in the first place. Just that the results weren't working, so I started stuffing in video parameters to try and get it to work.

so, the following, should work?

video1=AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop (0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)
#last should == video1

video=video1.trim(3555,6755)+video1.trim(48734,50615)+video1.trim(79504,82992)
#last should == video

#target video width
tx = 720
ty = 378

topborder = (((480-ty)/2)/16)*16 # top letterboxing rect, rounded to 16 pixels
#use default last stream to resize
BicubicResize(tx, ty )
#last should == video.biCubicResize(tx,ty)

#use default last stream to add borders
AddBorders(0,topborder,0,480 - (topborder + ty) ) # add black letterbox bars to 720 x 480 frame size
#last should == video.biCubicResize(tx,ty).AddBorders(0,topborder,0,480- (topborder+ty))


And this was the simple part, combining 5 parts just gets a bit more complicated, but hopefully not too much.

Richard Berg
7th March 2003, 03:30
Nope, still not correct. "last" is not modified when you assign another variable to a clip.

Wilbert
7th March 2003, 10:44
If you don't want to use last, the shortest will be:

AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop(0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)

video=trim(3555,6755)+.trim(48734,50615)+trim(79504,82992)

#target video width
tx = 720
ty = 378

topborder = (((480-ty)/2)/16)*16 # top letterboxing rect, rounded to 16 pixels

#use default last stream to resize
BicubicResize(video, tx, ty )

#use default last stream to add borders
AddBorders(0,topborder,0,480 - (topborder + ty) ) # add black letterbox bars to 720 x 480 frame size

Or shorter:

tx = 720
ty = 378
topborder = (((480-ty)/2)/16)*16

AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop(0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)
trim(3555,6755)+trim(48734,50615)+trim(79504,82992)
BicubicResize(tx, ty )
AddBorders(0,topborder,0,480 - (topborder + ty) )


If you want to use last:

AviSource("G:\CAPTURE000.00.avi").Telecide(guide=1).Decimate(cycle=5).Crop(0, 103, 720, 276).Tweak(0.0, 0.80, 1.0, .92)
video=last.trim(3555,6755)+last.trim(48734,50615)+last.trim(79504,82992)

#target video width
tx = 720
ty = 378

topborder = (((480-ty)/2)/16)*16

BicubicResize(video, tx, ty) # you can't use last here because last is not a clip

AddBorders(0,topborder,0,480 - (topborder + ty) )


Oh, make sure that you use even values for Crop, unless your Avi is RGB!