Log in

View Full Version : overlay() and watermark


lamola2003
29th May 2004, 09:19
Attached 2 files.
movie.jpg is a photogram of my movie
moviewithwatermark.jpg is the photogram of movie I want.
How I can put that class of water mark in my movie with the function "overlay"?

http://img19.imageshack.us/img19/3885/Movie.jpg
http://img19.imageshack.us/img19/3092/MoviewithWatermark.jpg

Thank on advance.

lamola.

stickboy
29th May 2004, 09:59
You should be able to adapt my script from this thread:
Logo with fade in and out (http://forum.doom9.org/showthread.php?s=&threadid=72445#post456800)

lamola2003
30th May 2004, 09:52
Thanks stickboy.

This script is my adaptation.
src=AviSource("Disney.avi")
logo = ImageReader("D:\borrar\marca.bmp", 0, 0, 1, true)
logo = logo.AssumeFPS(src.FrameRate())
logoMask = ImageReader("D:\borrar\marcamascara.bmp", 0, 0, 1, true)
Overlay(src, logo,mask=logoMask)


This script is bad, I need help.
loadplugin("d:\borrar\dvinfo.dll")
src=AviSource("Disney.avi")
DVInfo(src)
logo = ImageReader("D:\borrar\marca.bmp", 0, 0, 1, true)
logo = logo.AssumeFPS(src.FrameRate())
logoMask = ImageReader("D:\borrar\marcamascara.bmp", 0, 0, 1, true)
Overlay(src, logo,mask=logoMask)

And this the message warning:
DVInfo: Canīt open AVI file
(D:\borraR\overlay.avs, line4)

Thanks
lamola

stickboy
30th May 2004, 10:52
I don't think you're using DVInfo correctly. You need to pass it the filename of the DV file. (Also, as written, your script doesn't do anything with the output from DVInfo.) Try:
Loadplugin("d:\borrar\dvinfo.dll")
src=AviSource("Disney.avi")
src = src.DVInfo("Disney.avi")
logo = ImageReader("D:\borrar\marca.bmp", 0, 0, 1, true)
logo = logo.AssumeFPS(src.FrameRate())
logoMask = ImageReader("D:\borrar\marcamascara.bmp", 0, 0, 1, true)
Overlay(src, logo,mask=logoMask)(The DVInfo documentation implies that the filename argument is optional, but I think that's a mistake.)

lamola2003
30th May 2004, 19:03
Thanks Stickboy.
Your script work fine.
lamola

hartford
3rd June 2004, 05:03
I do many TV captures. My filter chain depends on the material and the noise.



For "live" broadcasts, I usually try first

CNR2()

and then see what it looks like in VirtualDub. I then try various VDub filters to
reduce the noise.

My concern was concentrated on skin colors. This chain worked very well on the "live" capture that I did recently

AviSynth:

jdl_UnfoldFieldsVertical(flip=true)
CNR2()
jdl_FoldFieldsVertical(flip=true)
RemoveDirt(mthreshold=4*255,athreshold=18,pthreshold=20,soscillation=10,doscillation=255,dist=2,tolerance=12,show=0)
TweakColor(sat=0.90,startHue=80,endHue=140,maxSat=90,minSat=75) # kill red oversaturation

VirtualDub filtering next:

DynamicNoiseReduction = 4
Levels ([0.06-1.00]> 1.00> [0.06-0.92](Y))






For anime I generally use

AviSynth:

jdl_UnfoldFieldsVertical(flip=true)
Convolution3D(1, 3, 10, 6, 8, 2.8, 0)
jdl_FoldFieldsVertical(flip=true)
RemoveDirt()
DeRainbowYUY2(last,10)
TweakColor(sat=0.90,startHue=80,endHue=140,maxSat=90,minSat=75)

VirtualDub next:

DynamicNoiseReduction = 6
StaticNoiseReduction = 4
Levels ([0.06-1.00]> 1.00> [0.06-0.92](Y))


The "jdl" filters are scripts available from http://www.avisynth.org/stickboy/


That's a start. For black and white captures I do a GrayScale() in
AviSynth and often convert to YV12 to use other AviSynth filters.


Hope that this was helpful.

lamola2003
3rd June 2004, 14:37
??

Wilbert
3rd June 2004, 16:31
Answering in the wrong thread perhaps :)

Ginta
23rd June 2004, 00:18
Let's say I want to put the logo in a specific position on the video (let's say coordinates x=30, y=100). How could I do this using overlay? Is it possible?

stickboy
23rd June 2004, 06:08
You call Overlay with the arguments x=30, y=100. Read the documentation included with AviSynth.

HeadlessCow
24th June 2004, 03:33
Hmm...never realized anyone else was wondering about this stuff. Here's my little Logo function that exposes most (all?) of the useful bits of the Logo filter for vdub.


function Logo (clip orig, string image, int start, int length, int "fadein", int "fadeout", int "trans", int "x", int "y", int "threshold" )
{
trans = Default(trans, 0)
fadein = Default(fadein, 0)
fadeout = Default(fadeout, 0)
x = Default(x, 0)
y = Default(y, 0)
threshold = Default(threshold, 0)
framerate = orig.framerate()
overlay = ImageReader(image, 0, length-1, framerate, false)
mask= overlay.ConvertToRGB32().ColorKeyMask(trans, threshold).ShowAlpha().FadeIO(fadein,fadeout)
numframes = overlay.framecount()
origclip = orig.Trim(start, start+length-1)
newclip = Overlay(origclip,overlay,x=x, y=y, mask=mask)
return orig.Trim(0, start - 1) + newclip + orig.Trim(start + numframes, 0)
}


orig is the original video
image is the image filename
start is the start frame
length is the length of the logo
fadein is how many frames to fade in
fadeout is how many frames to fade out
trans is the decimal value of the color to use as transparent
x is the offset from the left edge
y is the offset from the top edge
threshold is the amount that a pixel can differ from the transparent color and still be marked transparent (I assume this works, I've never had a reason to use it)

You need to be using one of the 2.55 cvs builds to use this otherwise ImageReader won't accept non-integer framerates.

stickboy
24th June 2004, 04:14
Originally posted by HeadlessCow
You need to be using one of the 2.55 cvs builds to use this otherwise ImageReader won't accept non-integer framerates.If that's your only holdup:
ImageReader(image, 0, length-1, 1, false).AssumeFPS(framerate)
return orig.Trim(0, start - 1) + newclip + orig.Trim(start + numframes, 0)Be careful with Trim. (http://forum.doom9.org/showthread.php?s=&threadid=58358) In this example, you should watch out for the cases where start == 1 and where start + numFrames > orig.FrameCount().

HeadlessCow
28th June 2004, 04:55
Originally posted by stickboy
If that's your only holdup:
ImageReader(image, 0, length-1, 1, false).AssumeFPS(framerate)

As far as I know it's the only holdup :) it's the only one people have complained to me about when they weren't using a cvs build :)
Originally posted by stickboy
Be careful with Trim. (http://forum.doom9.org/showthread.php?s=&threadid=58358) In this example, you should watch out for the cases where start == 1 and where start + numFrames > orig.FrameCount().
Ah, good points...I've never personally used either of those cases, so never noticed a problem :)