Log in

View Full Version : Using overlay() on trimmed clips


octavarium
29th October 2008, 21:23
I feel like i've worked myself into a corner, and i need help getting this script to add an overlay. I've trimmed out sections to do different processing to save time and since the opening is a regular movie and the rest is anime, i'd like to keep it this way if possible. All that i have tried seems to fail, and the only way i've been able to get the overlay added is by commenting out everything except the clip1/clip2 variables. I'm trying to add the overlay to trimmed section 'a'. Here's what i have to work with.
clip1 = DGDecode_mpeg2source("E:\Projects\DesertPunk\v1.d2v", info=3)
clip2 = avisource("E:\Downloads\DesertPunkOP.avi")
Overlay(clip1, clip2, mode="blend", opacity=0.5)
a = trim(clip1,45,2742)
b = trim(clip1,2743,43499)
c = a.ColorMatrix(hints=true).ConvertToYV12().tfm(order=1).tdecimate(hybrid=1).Crop(4,4,-2,-4).Spline64Resize(640,480).Convolution3D( "MovieLQ" ).Tweak(hue=0.12,sat=1.3,cont=1.14,bright=-5.62)
d = b.ColorMatrix(hints=true).ConvertToYV12().tfm(order=1).tdecimate(hybrid=1).antialiasing(order=1).Crop(4,4,-2,-4).Spline64Resize(640,480).degrainmedian(4,6,1,false,false).HQDN3D(2.6,4.2,1,3.8).fastlinedarken(102,212,224,1).WarpSharp().Tweak(hue=0.12,sat=1.3,cont=1.14,bright=-5.62)
e = c+d
return(e)
any suggestions would be greatly appreciated.

Gavino
29th October 2008, 21:34
You are not using the Overlay in the result of your script.
You want
clip1 = Overlay(clip1, clip2, mode="blend", opacity=0.5)

octavarium
30th October 2008, 03:42
thank you for replying so quickly, i had fabricated this post very quickly only a couple of minutes before work, and i have tried your suggestion, but it does not seem to help. I want to add the after effects to trimmed section 'a' and this will only overlay from the start of clip1. I'm very much novice as far as scripting is concerned. Is there any way i could set this overlay to run just on this trimmed section?

kemuri-_9
30th October 2008, 05:35
so you're trying to get 'clip2' overlayed onto 'a' right?

then after the a = trim(...) line you should be able to do
a = Overlay(a, clip2, mode="blend", opacity=0.5)
before the
c = a.ColorMatrix()... line so it'll be changed in time for c

octavarium
30th October 2008, 08:18
Yes, that's exactly what i was trying to do. Thank you Kemuri-_9. Now that i know what needs to be done, i can get this working on my other scripts with ease. :)

Gavino
30th October 2008, 11:20
thank you for replying so quickly ...
... So quickly that I failed to spot that you wanted the overlay applied only to section 'a'. :)

Anyway, the point to note is that Overlay(c1, c2, ...) does not change the variable c1 - only an assignment (c1 = ...) can do that. If there is no explicit assignment, Avisynth assigns the result to the special variable called 'last'.

Another point on your script: ColorMatrix(hints=true) needs to come directly after the mpeg2source filter that produces the hints. So you should change the first line to

clip1 = DGDecode_mpeg2source( ... , info=3).ColorMatrix(hints=true)

and remove the later uses of ColorMatrix.

octavarium
30th October 2008, 14:30
thank you. avisynth was throwing me errors so i already re-wrote the script. This is working quite well
clip1 = DGDecode_mpeg2source("E:\Projects\DesertPunk\v1.d2v", info=3).ColorMatrix(hints=true).ConvertToYV12().tfm(order=1).tdecimate(hybrid=1)

a = trim(clip1,36,289)
b = trim(clip1,290,2194)
c = trim(clip1,2195,34799)

clip2 = avisource("E:\Downloads\DesertPunkOP.avi")

d = a.Crop(4,4,-2,-4).Spline64Resize(640,480).Convolution3D( "MovieLQ" ).Tweak(hue=0.12,sat=1.3,cont=1.14,bright=-5.62)
e = b.Crop(4,4,-2,-4).Spline64Resize(640,480).Convolution3D( "MovieLQ" ).Tweak(hue=0.12,sat=1.3,cont=1.14,bright=-5.62)
f = c.antialiasing(order=1).Crop(4,4,-2,-4).Spline64Resize(640,480).degrainmedian(4,6,1,false,false).HQDN3D(2.6,4.2,1,3.8).fastlinedarken(102,212,224,1).WarpSharp().Tweak(hue=0.12,sat=1.3,cont=1.14,bright=-5.62)
e = Overlay(e, clip2, mode="blend", opacity=0.5)

g = d+e+f

return(g)