Log in

View Full Version : Doubt about layers


Unrok
15th July 2005, 13:17
Hello everybody


I have a doubt about layers. When together the videos, the original video (clip_1) appears perfect but the logo(clip_2) does not appear perfect, just appear when the background is black and in anothers backgrounds it does not appear or appears weak.


With the code avs below: (logo and video appears 50% each)
##############################################################
clip_1=ConvertToRGB32(AVISource("movie_01.avi"))
clip_2=ConvertToRGB32(AVISource("logo_.avi"))
clip_1.Trim(0, 2414) \
+ clip_1.Trim(2415, 2541).Layer(clip_2, "add", 128, 0, 0, use_chroma=true) \
+ clip_1.Trim(2542, 0)
###############################################################

Result:
http://geocities.yahoo.com.br/leon_br3/logo_pos_avs_simple.jpg



With code avs with mask and greyscale: (video 100% / logo appears weak)

################################################################
clip_1=ConvertToRGB32(AVISource("movie_01.avi"))
clip_2=ConvertToRGB32(AVISource("logo_.avi"))
clip_3=ConvertToRGB32(AVISource("logo_.avi"))
Greyscale (clip_3)
logo = clip_2.Mask(clip_3)

clip_1.Trim(0, 2414) \
+ clip_1.Trim(2415, 2541).Layer(logo, "add", 255, 0, 0, use_chroma=true) \
+ clip_1.Trim(2542, 0)
###############################################################

Result:
http://geocities.yahoo.com.br/leon_br3/logo_pos_avs.jpg


It would like that it was thus (image below, By photoshop xD):

http://geocities.yahoo.com.br/leon_br3/equal.jpg


Somebody can help me?


Notes:

1) thanks stickboy for the answer in another topic
2) clip_2 have a background black
3) clip_1 is a movie \o/
4) Don’t have erros message
5) Sorry for the english, i usage altavista translation

matrix
15th July 2005, 17:20
Have you tried using "lighten", instead of "add" ?

clip_1.Trim(0, 2414) \
+ clip_1.Trim(2415, 2541).Layer(logo, "lighten", 255, 0, 0) \
+ clip_1.Trim(2542, 0)

mg262
15th July 2005, 17:28
Or you can use the alpha channel to specify where the original image is actually a logo and where it is just transparent (You will need to use layer with level=255). Equivalently you can use a mask -- either by using overlay or by using functions from MaskTools. Look at the documentation for Overlay and/or MaskTools and shout if you have trouble.

I would tend to go with the mask myself because I prefer to avoid converting to the RGB colourspaces... but maybe you have some other reason for doing that.

Unrok
16th July 2005, 20:15
clip_1=ConvertToRGB32(AVISource("movie.avi")).ChangeFPS(23.976)
clip_2=ConvertToRGB32(AVISource("logo.avi"))
clip_3=ConvertToRGB32(AVISource("gray.avi"))
Greyscale (clip_3)

mask_clip = Mask(clip_3.GreyScale.Levels(0, 1, 75, 0, 255))

clip_1.Trim(0, 2414) \
+ clip_1.Trim(2415, 2541).Overlay(clip_2, mask=ShowAlpha(mask_clip), mode="blend", opacity=1) \
+ clip_1.Trim(2542, 0)


I used overlay and function perfect


But it appeared one another error, logo was perfect, but after encode, the last frame of movie.avi appears before the start of the video and the last frame of logo.avi appears before starting the animation(clip_2).

Example:
Last frame of logo (frame 2542) it appears in (frame 2414)
Last frame of movie.avi it appears before frame 1

I did not understand why this exchange of frames occurred

:helpful:

mg262
16th July 2005, 21:34
But it appeared one another error, logo was perfect, but after encode...

Does that mean that the error didn't occur before encode? I.e. if you open the file up in VirtualDub does the error occur? If not itmight be a problem with the encoder rather than av synth. If it is an avisynthe problem...

Where possible it is useful to post a minimal script causing the error... so in this case it would be worth checking with all three Trims are necessary; i.e. does this produce a problem:

clip_1=ConvertToRGB32(AVISource("movie.avi")).ChangeFPS(23.976)
clip_2=ConvertToRGB32(AVISource("logo.avi"))
clip_3=ConvertToRGB32(AVISource("gray.avi"))
#Greyscale (clip_3)

mask_clip = Mask(clip_3.GreyScale.Levels(0, 1, 75, 0, 255))

clip_1.Trim(2415, 2541).Overlay(clip_2, mask=ShowAlpha(mask_clip), mode="blend", opacity=1)

(By the way, the line Greyscale (clip_3) doesn't do anything.)

It would also be worth removing things like that ChangeFPS to see if that is necessary to produce the error. Similarly, you could try simplifying the overlay command by for example removing the mask argument.

Unrok
17th July 2005, 00:03
Does that mean that the error didn't occur before encode? I.e. if you open the file up in VirtualDub does the error occur? If not itmight be a problem with the encoder rather than av synth. If it is an avisynthe problem...

I made some modifications and he did not give resulted. Three TRIM are necessary, since logo appears in one definitive time and later it disappears. I use "Changefps(23.976)" because movie.avi has 120fps then convert for 23.976. Without avisynth these errors do not occur and when I open the video in virtualdub (with avisynth code) such errors do not exist, they only appear after encode.

:confused:

Wilbert
17th July 2005, 00:14
AVISource("movie.avi")
Info()


Still 120 fps?

Unrok
17th July 2005, 00:44
AVISource("movie.avi")
Info()


Still 120 fps?


The original video (movie.avi) has 120fps

http://geocities.yahoo.com.br/leon_br3/Info.jpg

Edit:
Well, right now with a simple code:
AviSource("movie.avi").ChangeFPS(23.976)
this problem of frames occurs