PDA

View Full Version : Crop with Trim projects ghostings


dollparts
18th November 2008, 15:21
Hello. I've bumped into something really weird while working with the Trim command. The problem I want to solve is a video with varying black boarders, for instance, in the middle of the movie a sequence appears with black boarders even if I crop the rest of the video good. I was told that the Trim command could help me solve this. As it turns out, this have given me far more problems. The line I was told to use was this:


# TRIM
Trim1=Trim(0,17777).crop(12,8,688,560).LanczosResize(512,368)
Trim2=Trim(17778,24949).crop(12,8,688,548).LanczosResize(512,368)
Trim3=Trim(24950,72315).crop(12,8,688,560).LanczosResize(512,368)
Trim1+Trim2+Trim3


By using this line I also was told to disable the universal crop and resizing lines by adding a # before them. In other words, this is the essential in my script:


# SOURCE
mpeg2source("x:\x\x.d2v")

# TRIM
Trim1=Trim(0,17777).crop(12,8,688,560).LanczosResize(512,368)
Trim2=Trim(17778,24949).crop(12,8,688,548).LanczosResize(512,368)
Trim3=Trim(24950,72315).crop(12,8,688,560).LanczosResize(512,368)
Trim1+Trim2+Trim3

# DEINTERLACING (1)
TomsMoComp(1,5,1)

# CROPPING
#crop(12,8,688,560)

# RESIZING
#LanczosResize(512,368)


The video is PAL, 25fps, and without the Trim script it looks great in virtualdub. But with this script I get nasty ghostings! I should also mention that even if I remove the crop/resize part from the Trim script, the ghosting is still there. So the Trim itself seems to be the cause. Why? I don't modify the ivtc in any way with the script, only cropping and resize, so how can it create ghostings like this? I use avisynth 2.5 and I'd be grateful for any inputs on this odd error.

neuron2
18th November 2008, 15:57
Resizing before deinterlacing is a big no-no. Put TomsMoComp() right after MPEG2Source().

dollparts
18th November 2008, 16:44
Hi and thanks! It didn't help but I'll keep that in mind in either case. I modified the script a little and now it works as I wanted, but I had to remove the last trimmer. Check this out:


LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\TomsMoComp.dll")

mpeg2source("x:\x\x.d2v")

TomsMoComp(1,5,1)

Trim(0,17778).crop(12,8,688,560).LanczosResize(512,384)+trim(17779,24949).crop(12,8,688,548).LanczosResize(512,384)

Undot()


^ works fine, but as you can see the last trim, the one which includes frame 17779,24949 is left out. If I add the third trim line that deals with those last frames, I get an error while trying to load the script in.


LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\TomsMoComp.dll")

mpeg2source("x:\x\x.d2v")

TomsMoComp(1,5,1)

Trim(0,17778).crop(12,8,688,560).LanczosResize(512,384)+trim(17779,24949).crop(12,8,688,548).LanczosResize(512,384)+trim(24950,72315).crop(12,8,688,560).LanczosResize(512,368)

Undot()


Loading this into virtualdub gives me this error: Avisynth fopen failure: Splice: Frame sizes don't match

I would guess I'm really close now. Any ideas?

neuron2
18th November 2008, 17:38
Your resize on the last segment does not match the others. It should be LanczosResize(512,384).

dollparts
18th November 2008, 22:43
Ack, of course. Solved - thanks!

(Still curious how this could cause ghosting, but as long as it's fixed I'm fine)

Gavino
18th November 2008, 23:40
Still curious how this could cause ghosting, but as long as it's fixed I'm fine
There's no way Trim on its own can cause ghosting. I'm sure the problem was due solely to cropping/resizing before deinterlacing and you were mistaken in thinking that you saw it without that.

neuron2
18th November 2008, 23:42
I'm sure, too, but I didn't want to be impolite, especially as I find her/his avatar to be so cool. :)