Log in

View Full Version : Layering two files


benw
30th September 2013, 16:29
I have an .avi file in which each frame has a time stamp in the left upper corner. I have cropped the time stamp alone (2) and cropped the entire frame excluding the time stamp (1).

I now want to layer the two files so that the time stamp (2) is in the middle of the bottom of the entire frame (1).

I used the script below:

clip1 = AviSource("C:\(1).avi").ConvertToYUY2
clip2 = AviSource("C:\(2).avi").ConvertToYUY2
return Layer(clip1, clip2, "fast", x=380, y=375)

This accomplishes the layering and positioning but the time stamp (2) is very washed out - I assume because it is transparant. What do I have to add to the script above to make (2) opaque and look like the original (2)?

Thanks!

Ben

manono
1st October 2013, 10:46
Have you tried doing it using Overlay? Does this work?

clip1 = AviSource("C:\(1).avi").ConvertToYUY2
clip2 = AviSource("C:\(2).avi").ConvertToYUY2
Overlay(clip1, clip2, x=380, y=375)

I couldn't make much sense of the Layer page, if leaving out 'fast' will make it opaque (why use it in the first place?), or if you have to set the level to 256. And it doesn't give the default settings for everything either.

Perhaps someone else will come along that actually uses Layer. I only use Overlay myself.

Edit later: Misspoke myself.

Gavino
1st October 2013, 15:48
return Layer(clip1, clip2, "fast", x=380, y=375)

This accomplishes the layering and positioning but the time stamp (2) is very washed out - I assume because it is transparant.
That's because "fast" takes the average of the two clips, whereas you want to simply put clip2 opaquely on top of clip1.

Use "add" instead; since it is the default you can write
return Layer(clip1, clip2, x=380, y=375)

or use Overlay instead, as manono suggests.
In that case, you wouldn't need to convert the clips to YUY2 either.

benw
2nd October 2013, 00:48
Thanks to both of you. I used overlay and got the results that I wanted. I was told that layer was faster.

Ben

Gavino
2nd October 2013, 09:39
I was told that layer was faster.
It is faster for the formats it directly supports, ie RGB32 and YUY2.
For other formats a prior conversion is required, which reduces (or perhaps even negates) the advantage.

benw
2nd October 2013, 15:06
Thanks!

Ben