Log in

View Full Version : Overlay subtitle


manusse
2nd November 2008, 22:02
Hi,

Maybe this question has already been asked but a simple search on the forum didn't give me an answer. So please direct me to the answer if it already exists.
My problem is rather simple:
I own a low cost HDD-camcorder with which I've filmed some home movies. The format output by the camcorder is mpeg2, 720x576 25fps interlaced (PAL) with a 16:9 aspect ratio. I want to overlay some ass subtitle but I want them to match the 16:9 aspect ratio. Also I don't want to modify my ass file if possible.
I've tried the following script (v is my video clip):

v=ConvertToRGB32(v)
v=ResetMask(v)
BackGround=BlankClip(v,width=width(v)*4/3)
BackGround=TextSub(BackGround,"presentations.ass")
BackGround=BicubicResize(BackGround,width(v),height(v))
v=OverLay(v,Background,mode="add",opacity=1)
return v

This works quite well except I would like my subtitle to be opaque and here it is transparent. I know this comes from the OverLay instruction. Is there a simple way to overlay Background with all its non-black areas being opaque and overlaid on top of v and its black areas being transparent?

Thanks for your help
Manusse

Alex_ander
2nd November 2008, 23:07
In the last line you need to use a mask image (by defining it as 'mask' parameter) of same dimensions and position as the overlay clip; it should be white for what you want to display (letters with their edges) and black where you want full transparency within the overlay. When you don't use any mask, the default transparency control color is white (opacity) in overlay's rectangle.

Gavino
3rd November 2008, 00:53
The required mask can be constructed using the Levels filter:
mask = background.Greyscale.levels(0, 1.0, 1, 0,255)
then do the Overlay like this
v=OverLay(v, Background, mask=mask)

Comatose
3rd November 2008, 06:30
Is there any specific reason you don't want to modify the .ass file? This seems rather roundabout :/

For fitting them to 16:9, you could either just change the styles so you can natively render it on 16:9 (I think "Resample Resolution" in Aegisub might also work), or change the X and Y scales to stretch the subs like they would be when upsized (see the Aegisub documentation Aspect Ratios section for more information).

manusse
3rd November 2008, 23:31
Hi,

Thanks for your answers. I tried Gavino's method and it's working fine. I'll also have a look at the aspect ratio in AegiSub.

Thanks for your help
Manusse