View Full Version : Weird problem with layers and diagonal distortion.
_argos
7th June 2004, 08:28
Hello you experts! :)
After reading the forum for 2 years now i finally registred. I got a lot of help from threads in this forum, but now i can't find a solution for my problem in other threads.
Here's my problem: I want do a DVD menu with motion. Nothing spectacular. There are 3 layers overlaying one background picture. These are masked. for the first 25 frames everything looks fine, but then i get a nasty distortion of the layered areas.
Before frame 25 (http://home.arcor.de/deusexmachina/bilder/before25.jpg)
After frame 25 (http://home.arcor.de/deusexmachina/bilder/after25.jpg)
I can't find the source for my problem as the script is very simple.
This is my script:
# Hintergrundbild
dvdmenu = ImageReader("g:\background.bmp", 0, 0, 25, false).Loop(500).ConvertToRGB32()
# Masken
mask1 = ImageReader("g:\maske1.bmp", 0, 0, 1, false).BicubicResize(150,100).ConvertToRGB32()
mask2 = ImageReader("g:\maske2.bmp", 0, 0, 1, false).BicubicResize(150,100).ConvertToRGB32()
mask3 = ImageReader("g:\maske3.bmp", 0, 0, 1, false).BicubicResize(150,100).ConvertToRGB32()
# Clips
clip1 = AVISource("g:\clip1_preview.avi", false).ConvertToRGB32().fadein(25)
clip2 = AVISource("g:\clip2_preview.avi", false).ConvertToRGB32().fadein(25)
clip3 = AVISource("g:\clip3_preview.avi", false).ConvertToRGB32().fadein(25)
# Verbinden mit maske
vclip1 = Mask(clip1, mask1)
vclip2 = Mask(clip2, mask2)
vclip3 = Mask(clip3, mask3)
# Positionieren
dvdmenu = Layer(dvdmenu, vclip1, "add", 255, 148, 295)
dvdmenu = Layer(dvdmenu, vclip2, "add", 255, 279, 296)
dvdmenu = Layer(dvdmenu, vclip3, "add", 255, 411, 296)
return dvdmenu
The mask pictures are 24bit RGB BMP-images. All 150x100.
hope someone sees the problem. maybe i'm just blind.
greetings
_argos
Manao
7th June 2004, 08:52
You didn't define your masks to last more than one second. Try the following script :
# Hintergrundbild
dvdmenu = ImageReader("g:\background.bmp", 0, 0, 25, false).Loop(500).ConvertToRGB32()
# Masken
mask1 = ImageReader("g:\maske1.bmp", 0, 0, 25, false).Loop(500).BicubicResize(150,100).ConvertToRGB32()
mask2 = ImageReader("g:\maske2.bmp", 0, 0, 25, false).Loop(500).BicubicResize(150,100).ConvertToRGB32()
mask3 = ImageReader("g:\maske3.bmp", 0, 0, 25, false).Loop(500).BicubicResize(150,100).ConvertToRGB32()
# Clips
clip1 = AVISource("g:\clip1_preview.avi", false).ConvertToRGB32().fadein(25)
clip2 = AVISource("g:\clip2_preview.avi", false).ConvertToRGB32().fadein(25)
clip3 = AVISource("g:\clip3_preview.avi", false).ConvertToRGB32().fadein(25)
# Verbinden mit maske
vclip1 = Mask(clip1, mask1)
vclip2 = Mask(clip2, mask2)
vclip3 = Mask(clip3, mask3)
# Positionieren
dvdmenu = Layer(dvdmenu, vclip1, "add", 255, 148, 295)
dvdmenu = Layer(dvdmenu, vclip2, "add", 255, 279, 296)
dvdmenu = Layer(dvdmenu, vclip3, "add", 255, 411, 296)
return dvdmenu
_argos
7th June 2004, 16:50
thanx 4 answer, manao. :) but NO. that doesn't solve the problem. the frames after 25 look still as they did before on the screenshot. weird. the "fadein" seems to make the mask look good. if i remove the "fadein" the mask looks distorted from the beginning.
if some1 want to try .... i put the script with the massk, bgimage and preview-clip in an archive.
Here (http://home.arcor.de/deusexmachina/data/distortionproblem.rar)
greetings
_argos
Manao
7th June 2004, 17:21
Try the following workaround :
# Hintergrundbild
dvdmenu = ImageReader("g:\background.bmp", 0, 0, 25, false).Loop(500).ConvertToRGB32()
# Masken
mask1 = ImageReader("g:\maske1.bmp", 0, 0, 25, false).Loop(500).BicubicResize(150,100).ConvertToRGB32()
mask2 = ImageReader("g:\maske2.bmp", 0, 0, 25, false).Loop(500).BicubicResize(150,100).ConvertToRGB32()
mask3 = ImageReader("g:\maske3.bmp", 0, 0, 25, false).Loop(500).BicubicResize(150,100).ConvertToRGB32()
# Clips
clip1 = AVISource("g:\clip1_preview.avi", false).ConvertToRGB32().fadein(25).ConvertToRGB24().ConvertToRGB32()
clip2 = AVISource("g:\clip2_preview.avi", false).ConvertToRGB32().fadein(25).ConvertToRGB24().ConvertToRGB32()
clip3 = AVISource("g:\clip3_preview.avi", false).ConvertToRGB32().fadein(25).ConvertToRGB24().ConvertToRGB32()
# Verbinden mit maske
vclip1 = Mask(clip1, mask1)
vclip2 = Mask(clip2, mask2)
vclip3 = Mask(clip3, mask3)
# Positionieren
dvdmenu = Layer(dvdmenu, vclip1, "add", 255, 148, 295)
dvdmenu = Layer(dvdmenu, vclip2, "add", 255, 279, 296)
dvdmenu = Layer(dvdmenu, vclip3, "add", 255, 411, 296)
return dvdmenu
_argos
7th June 2004, 19:00
:) you are my hero. it works. not sure why, but it works! :)
greetings
_argos
Didée
8th June 2004, 08:20
Hoppla! What's going on here?
ConvertToRGB32().fadein(25)
gives no fun, but
ConvertToRGB32().fadein(25).ConvertToRGB24().ConvertToRGB32()
works as expected :confused:
By definition of the word, that is Esoterics!
BTW, two days ago I had a case ... I was working with an mpeg-2 input. Some intermediate scenes had to be pre-converted, to avoid huge complexity. I used MarcFD's VBLE codec for that. Later, I wanted to mix both the VBLE scenes and the normal *.d2v input back together.
Shortly:
- info() showed that both clips had exactly the same properties. No differences at all.
- [VBLE] + [d2v] was working. nothing special.
but:
- dissolve( [VBLE], [d2v], xyz )
here AviSynth complained: "Dissolve: video formats don't match".
ConvertToYUY2().ConvertToYV12() - same error.
AssumeFrameBased.ConvertToYUY2().ConvertToYV12() - aahh, i's working!
- Didée
Manao
8th June 2004, 09:47
Didee : no worries : the bug is in "mask", the filter expect both clip to have the same pitch, but in this cases, they hadn't. ConvertToRGB24().ConvertToRGB32() made them have the same pitch.
For the "video format" bug : Dissolve suffers from the same issue Subtract was suffering : when testing the colorspace of the input, it makes the following test :if ( vi.pixel_type != vi2.pixel_type )But there are two YV12 spaces : YV12 and I420, so it's not the proper test.
Now, I can't see why adding AssumeFrameBased makes it work, except of course if when you added it, you also applied the combo YV12->YUY2->YV12 on the second clip.
stickboy
8th June 2004, 09:48
How bizarre. Those are definitely bugs. (Didee, do you have a script that can reproduce your Dissolve problem?)
For _argos's problem, another (and better) workaround is to ditch Layer and Mask completely and to use Overlay. No colorspace conversions necessary either.
stickboy
8th June 2004, 09:55
Originally posted by Manao
For the "video format" bug : Dissolve suffers from the same issue Subtract was suffering : when testing the colorspace of the input, it makes the following test :if ( vi.pixel_type != vi2.pixel_type )But there are two YV12 spaces : YV12 and I420, so it's not the proper test.Ah, that makes sense. It looks like that should already be fixed in the 2.55 alpha binaries.
Didée
8th June 2004, 10:07
I'll see if I can distille the problematic section out of the script - the original script is a little longish... Probably tomorrow, 'cause I've to do some travelling to get my hands on my own script :(
However: I knew about the YV12 <--> I420 issue. But I don't understand why ->YUY2->YV12 didn't work, but AssumeFrameBased()->YUY2->YV12 did.
I applied it to both clips, yes.
- Didée
Manao
8th June 2004, 10:32
But I don't understand why ->YUY2->YV12 didn't work, but AssumeFrameBased()->YUY2->YV12 did.I didn't see anything wrong in the source code. AssumeFrameBased() only modifies "image_type" and redefines "GetParity". None are used in the following filters, so I don't understand.
What happens if you use dissolve after the converttoyuy2() ?
Didée
10th June 2004, 12:38
In a nutshell:
That particular script produced so many strange effects, some of which seem basically "impossible", that I don't seriously give anything on those.
But fore sure I'll keep the script. Interesting things are going on there ;)
It's a big mess of a 'repairing' script, where I had to do VERY wicked operations. Incoming are several different video sources (D2V and VBLE) and audio (WAV). The mess goes on with several instances of trimming, splicing together, more trimming, more splicing ...
Then I have to mask-merge some splices onto some others, do even more trimming & splicing, etc. pp.
Inbetween all of this, some re-arranging by croping & stacking was done ...
I had a pretty hard time to keep track of what I was actually doing (and even lost track some times).
Some funny things that were going on:
- the mentioned problem with splicing
- on a fadeout(xy) section, audio was cut off hard for most values of xy, only certain ones would work
- on some masked merge operations, on parts where the mask was black (Y=0 - definetly zero, yes), sort of an "inverse multiply" was performed (content got brighter). Identical behaviour no matter wether Overlay() or MaskedMerge() was used.
Some AviSynth trolls seem to have settled down in that script :D
Perhaps there are even more funny effects to discover, if I'd search long enough.
But the real miracle is: in the end, I got exactly the wanted output (although it took me two days ...)
Bottomline: no need to look for any particular AviSynth bugs here. Seems I've simply driven things a little too far ;)
- Didée
sh0dan
11th June 2004, 09:26
The fix for "Mask" was rather simple - it's comitted to CVS.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.