View Full Version : Adding a water mark using Overlay
D0C
16th January 2005, 14:23
I'm trying to add a water mark to some video but having problems with the colours not looking right.
Logo to be added
----------------
http://www.taylor-stapleton.co.uk/Images/temp/watermarklogo(resized).jpg
Mask of Logo
------------
http://www.taylor-stapleton.co.uk/Images/temp/watermarklogomasked(resized).jpg
Sample of output
----------------
http://www.taylor-stapleton.co.uk/Images/temp/frame.jpg
Script
------
movie=avisource("footage.avi")
logo = ImageReader("watermarklogo(resized).jpg", 0, 0, 1, true)
logo = logo.AssumeFPS(movie.FrameRate()).FlipVertical()
logoMask = ImageReader("WaterMarkLogoMasked(resized).jpg", 0, 0, 1, true).FlipVertical()
Overlay(movie,logo,mode="add",mask=logomask)
Can anyone see whats wrong with the script, or explain to me why its not working like i expect. What i expected was the logo to just be superimposed over the video.
I also think the mask isn't quite right yet, but that can be easily fixed.
D0C
16th January 2005, 15:01
for some reason the sample frame won't off site link.
D0C
16th January 2005, 15:17
right seem to have fixed it
sh0dan
16th January 2005, 16:57
How do you expect it to look?
Have you tried the other blend modes, like "blend" instead of "add"?
D0C
16th January 2005, 17:01
well what i expect is to see,
http://www.taylor-stapleton.co.uk/Images/temp/watermarklogo(resized).jpg
on top of the video. looking exactly like it does there.
as you can see from the example frame it doesn't do that, i've also tried all the other modes and it doesn't make it look the way i want it to.
it also appears that the white in the original logo is being turned grey.
All i want is to be able to place the logo onto the video. Maybe i'm trying to do this using the wrong functions.
Didée
16th January 2005, 17:27
Could it be the problem is the mask being used having a 16~235 value range? After loading with ImageReader, the mask is RGB, but Overlay probably has to convert it internally to YUV ...
try the following:
logoMask = ImageReader("WaterMarkLogoMasked(resized).jpg", 0, 0, 1, true).FlipVertical()
logoMask = LogoMask.converttoyuy2().ColorYUV(levels="TV->PC")
/*me thinks if someone must produce himself by putting his watermark, he should figure himself how to do it*/
D0C
16th January 2005, 19:18
if that is the case wouldn't the logo have to be converted also as they were both made in photoshop
Didée
16th January 2005, 19:58
No. In RGB, the logo covers (of course) full 0~255 range. When converted to YUV, it is scaled to 16~235, and that's the correct scale. No need to make any additional adjustments. YUV 0~16 & 236~255 are "illegal" values for normal mpeg-X content. (As long as one works with ITU-601 content, not with ITU-709 HD-content.)
For masking, it's a different story. If the 0~255[RGB] mask is converted to 16~235[YUV], then the maximal overly strength is 235/255 = 0.9215... , or 92%. that would mean that even there where your mask originally was full-white, 8% of the original content would look through - and that explains the whites of your watermark getting grey.
I've to admit to be not fully sure how Overlay() handles that stuff, as I'm mostly working with the MaskTool's functions. And there, it is exactly as described.
What do I type and type. Just try it and see what's happening.
stickboy
16th January 2005, 22:08
1. "add" isn't the blend mode you want. Use "blend".
2. You shouldn't use JPEG for flat-color images. Use PNG.
3. Your logo JPEG uses CMYK color instead of RGB, which probably is also screwing things up.
I think the main problem is that there is something weird about your JPEG files. I can't get Firefox nor Internet Explorer to load them. If I open them in Photoshop and resave them (and make sure they're using RGB-space), then they seem to work fine.
D0C
17th January 2005, 21:31
ah that explains it, thanks for the help thats sorted out all the problems. Just need to make a mask that works how we need it to now.
golem
16th March 2005, 02:47
I've learned how to do many things with V'Dub/AVISynth but every attempt at using overlay is killing me. I am attempting to place a caption or two (similar to a logo or watermark) on some of the clips I encode.
To be honest, I just don't grasp it! I've read all the "overlay" threads I could find and tried for days to get one of them to work but all to no avail. What would be extremely helpful would be to know the following:
1. Where is the proper insertion location for the script?
2. What form should the mask be? Positive or negative of final image?
Finally, I've attached a script below which is representative of the intended application. It would be most helpful if someone could adapt this script with a working example of text/image overlay. I feel like a sod asking for a script to be written/finished for me but I'm truly at wits end on this one.
Loadplugin("I:\AviSynth_Scripts\filters_&_docs\mpeg2dec3.dll")
Loadplugin("I:\AviSynth_Scripts\filters_&_docs\decomb521.dll")
Loadplugin("I:\AviSynth_Scripts\filters_&_docs\Avisynth_2.5_Alpha\simpleresize.dll")
Loadplugin("I:\AviSynth_Scripts\filters_&_docs\undot.dll")
LoadPlugin("I:\AviSynth_Scripts\MSharpen.dll")
mpeg2source("I:\~HD\caddis_fly.d2v")
Telecide(order=1,guide=1,post=2,vthresh=30)
Decimate()
Trim(6,1393)
ColorYUV(off_y=0, gain_y=40)
Levels(0,1.0,255,0,255)
Tweak(Hue=0,Sat=1.0,Bright=0.0,Cont=1.0)
crop(16,2,-16,-16)
UnDot()
MSharpen(6,40,true,false,false)
Most Appreciative,
Golem
stickboy
16th March 2005, 04:51
I have an example available that you might want to take a look at: logo-example.zip (http://www.avisynth.org/stickboy/etc/logo-example.zip)
golem
16th March 2005, 06:52
Fabulous! I can begin breathing again!
I've shyed away from functions until now, searched the forum and found YOUR post on inserting/importing them, have that one licked finally. It then took me a little while to figure out how to depreciate all those "c" characters so as to be able to use the base clip referenced in my script. Hmmmm...that eagle's head looks darn good static at 75% alpha on my nature clips. ;-)
Well, have to get started on my own base and mask so let me say THANKS again for the quick and very helpful response!
Cheers,
Golem
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.