Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st January 2018, 07:33   #1  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
TIVTC, esp. TFM and y0/y1

I've done my first movie and it works pretty good with nothing more than the defaults. But I later discovered there was a logo shown along the bottom a few times scattered throughout. I can't tell whether it messed with TFM's efforts to decomb the telecined footage at those points. So I'd like to set Y0 and Y1 to exclude that part of the picture from ALL combing detection, but the docs do not offer any way to verify that I am coding the correct values. I hoped there'd be a way to temporarily see whatever part of the image it was excluding via some sort of temporary highlighting or coloring of the region. But nothing in "debug" seemed to implement this.

Assuming I can experimentally use Crop to find out where my last lines start and if that turned out to be the last 10 lines (just for example) of my 1920 x 1080 i30 movie, would y0 = 1070 and y1 = 1079?

That's the first and basic question. But another one is that I will sometimes have a 2nd logo and it will be at the TOP. How can I exclude a line region at the bottom AND at the top?? I'm suspecting I will be told it's impossible. Perhaps in lieu of that, there's a way to operate on frame ranges, doing a low y0/y1 pair for some footage and a high y0/y1 pair for other.
TCmullet is offline   Reply With Quote
Old 1st January 2018, 11:23   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
To show what changed.
Code:
# Return Clip Difference of input clips (amp==true = Amplified, show==true = show background)
Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") {
    amp=Default(amp,false)
    show=Default(show,false)
    c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale()
    c1=clip1.subtract(clip2)
    c1=(amp)?c1.levels(127,1.0,129,0,255):c1
    return (show)?c1.Merge(c2):c1
}

# Stack Overhead Subtitle Text, with optional FrameNumber shown.
Function TSub(clip c,string Tit,Bool "ShowFrameNo"){
    c.BlankClip(height=20)
    (Default(ShowFrameNo,False))?ScriptClip("""Subtitle(String(current_frame,"%.f] """+Tit+""""))"""):Subtitle(Tit)
    Return StackVertical(c).AudioDubEx(c)
}

Function WhateverFilter(clip c) {
    c
    OverLay(c.BlankClip(width=Width/2,height=height/2,color=$FF00FF),x=width/4,y=height/4,opacity=0.5)
}


src=ColorBars.ConvertToYV12.KillAudio
fixed = src.WhateverFilter()
D1=ClipDelta(Fixed,src,AMP=False)
D2=ClipDelta(Fixed,src,AMP=true)

TOP = StackHorizontal(src.TSub("Source"),Fixed.TSub("Fixed"))
BOT = StackHorizontal(D1.TSub("Diff"),D2.TSub("Diff AMP'ed"))
StackVertical(TOP,BOT)

# Show changed as non grey : non changed = grey
EDIT:


EDIT: Hm, we seem to have two different greys in non Amp'd, Amp'd (presumably 127 and 128, or 129).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st January 2018 at 11:55.
StainlessS is offline   Reply With Quote
Old 1st January 2018, 14:49   #3  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
Forgive me, but I am totally in the dark as to how to use this for my situation. What would I do? My current lines say:

tfm()
tdecimate()
TCmullet is offline   Reply With Quote
Old 2nd January 2018, 02:00   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
I hoped there'd be a way to temporarily see whatever part of the image it was excluding via some sort of temporary highlighting or coloring of the region. But nothing in "debug" seemed to implement this.
ClipDelta with Amp=true will show you what region was changed.

Source and fixed need be same frames so leave out the tdecimate() which is not part of what you want to see here anyway.

ie Clipdelta(source,source.tfm, amp=true)

EDIT: WhateverFilter() was intended to mean whatever you want to test, ie in your case tfm().
Although, you did not suppy the Y0/Y1 pair (whatever they are), so the untouched region will not be present anyway.
So, you need also insert the Y0/Y1 pair wherever is appropriate. [ eg Clipdelta(source,source.tfm(Y0=...,Y1=...), amp=true) ]

EDIT: To produce a single frame result of all changed regions in entire clip. (untested)
Code:
src     = AviSource(...)
Fixed = src.whateverFilter()   # whatever you are testing, including any Y0,Y1 or other args
src_Blend_Frame = src.ClipBlend.Trim(src.FrameCount-1,-1)        # Single frame blend of entire src clip
fix_Blend_Frame  = Fixed.ClipBlend.Trim(Fixed.FrameCount-1,-1)   # Single frame blend of entire fixed clip
return ClipDelta(src_Blend_Frame,fix_Blend_Frame,AMP=true)       # AMP'd differece between two clips showing areas that changed
ClipBlend:- https://forum.doom9.org/showthread.p...ight=ClipBlend

EDIT: Long since I've used tfm (if ever), is it being used to decomb, or to IVTC match frames ? if decomb
then above OK, it IVTC then above is perhaps rubbish (as frame matching will/may produce changes in entire frame).

EDIT: If is IVTC (and so above is maybe not working OK) then perhaps below will work (again untested).
Code:
src     = AviSource(...)
Fix1 = src.whateverFilter()                # whatever args for filtered version 1 (ie without Y0,Y1)
Fix2 = src.whateverFilter(Y0=...,Y1=...)   # whatever args for filtered version 2 (ie with Y0,Y1)

fix1_Blend_Frame = Fix1.ClipBlend.Trim(Fix1.FrameCount-1,-1)    # Single frame blend of entire Fix1 clip
fix2_Blend_Frame = Fix2.ClipBlend.Trim(Fix2.FrameCount-1,-1)    # Single frame blend of entire Fix2 clip
return ClipDelta(Fix1_Blend_Frame,Fix2_Blend_Frame,AMP=true)  # AMP'd differece between two fixed clips showing areas that are different
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd January 2018 at 04:04.
StainlessS is offline   Reply With Quote
Old 3rd January 2018, 19:10   #5  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
Please bear with me a bit more. I was going to submit my final code as a working example for others, but am not there yet. I THINK I have my code right, after discovered I had missed Clipblend, hunted and found it. Now my script is hung building 2 clipblend clips for a 4-hour HD movie. (I could abort it.) So now I look a little at Clipblend. Why on earth are we blending frames from a clip at all?? I wanted to see on a single frame what the effect of my filter (in this case TFM) is. Why blend all frames in the whole clip?

Pending an answer, I will change my "src" to have a (say) 5-frame subset of my 4 hr movie, which will be where a logo is.
TCmullet is offline   Reply With Quote
Old 3rd January 2018, 21:29   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
You can sample whatever range you want (if you use trim), Clipblend with default settings blends all preceding frames, with the current one,
the trim(FrameCount-1,-1) will return with the result of all frames blended together, as a single frame, so will scan the entire clip before return.
Without the trim, it will return the result so far as a video clip.
You could just leave out the trims, and see results of the clipDelta thing as you progress though the clip.

Maybe try
Code:
src     = AviSource(...)
Fix1 = src.whateverFilter()                # whatever args for filtered version 1 (ie without Y0,Y1)
Fix2 = src.whateverFilter(Y0=...,Y1=...)   # whatever args for filtered version 2 (ie with Y0,Y1)
fix1 = Fix1.ClipBlend
fix2 = Fix2.ClipBlend
return ClipDelta(Fix1,Fix2,AMP=true) # Or AMP = False
Again, untested.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th January 2018 at 14:10.
StainlessS is offline   Reply With Quote
Old 4th January 2018, 04:37   #7  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
With the video open, here is my code:
Code:
src=last.trim(36662,36669)

#tfm(pp=0,slow=2,y0=1040,y1=1079)

Fix1 = src.tfm(pp=0,slow=2)               # whatever args for filtered version 1 (ie without Y0,Y1)
Fix2 = src.tfm(pp=0,slow=2,y0=1040,y1=1079)   # whatever args for filtered version 2 (ie with Y0,Y1)

fix1_Blend_Frame = Fix1.ClipBlend
#.Trim(Fix1.FrameCount-1,-1)    # Single frame blend of entire Fix1 clip
fix2_Blend_Frame = Fix2.ClipBlend
#.Trim(Fix2.FrameCount-1,-1)    # Single frame blend of entire Fix2 clip
ClipDelta(Fix1_Blend_Frame,Fix2_Blend_Frame,AMP=true)  # AMP'd differece between two fixed clips showing areas that are different
It simply hangs. Can you, by inspection, tell what is my error?
TCmullet is offline   Reply With Quote
Old 4th January 2018, 14:39   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
It simply hangs.
For me, the below script just displays a constant grey clip, meaning result are identical all of the way throuigh the clip.
However, the test clip was progressive (I rarely have any NTSC stuff, and dont have any handy, I like to get rid of it as quick as possible.)

Code:
FN="1941 Flint Michigan Parade [Low, 360p].mp4.AVI"
Avisource(FN)

Crop(0,0,Width/4*4,Height/4*4)

Y0=300
Y1=340

Fix1 = tfm(pp=0,slow=2)
Fix2 = tfm(pp=0,slow=2,y0=Y0,y1=Y1)

B1 = Fix1.ClipBlend
B2 = Fix2.ClipBlend
ClipDelta(B1,B2,AMP=true)
Quote:
I can't tell whether it messed with TFM's efforts to decomb
Quote:
y0/y1 -

These define an exclusion band which excludes the lines between y0 and y1 from
being included in the field matching decision. An exclusion band can be used
to ignore subtitles, a logo, or other things that may interfer with the matching.
y0 sets the starting scan line and y1 sets the ending line, all lines in between
y0 and y1 (including y0 and y1) will be ignored. Set y0 equal to y1 to disable.

Default: y0 - 0 (int)
y1 - 0 (int)
Looks to me like y0,y1 are only to do with field matching and nothing to do with decombing.

Anyway, I assume that 'simply hangs' means grey screen clip, which means results are exactly the same.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th January 2018 at 15:11.
StainlessS is offline   Reply With Quote
Old 4th January 2018, 15:46   #9  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
Quote:
Originally Posted by StainlessS View Post
Anyway, I assume that 'simply hangs' means grey screen clip, which means results are exactly the same.
No, you're not taking me literally enough. Virtualdub locks up with the hourglass stuck on infiinitely. It never comes back to redisplay the current frame. I have to manually cancel Vdub from the X at upper right of the Vdub window.
TCmullet is offline   Reply With Quote
Old 4th January 2018, 16:16   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
So narrow down the problem, eg comment out the clipdelta thing and return subtract instead ie

Code:
FN="1941 Flint Michigan Parade [Low, 360p].mp4.AVI"
Avisource(FN)
Crop(0,0,Width/4*4,Height/4*4)
Y0=300
Y1=340
Fix1 = tfm(pp=0,slow=2)
Fix2 = tfm(pp=0,slow=2,y0=Y0,y1=Y1)
B1 = Fix1.ClipBlend
B2 = Fix2.ClipBlend
subtract(B1,B2)
if that dont work (hangs), look for the problem

Code:
FN="1941 Flint Michigan Parade [Low, 360p].mp4.AVI"
Avisource(FN)
Crop(0,0,Width/4*4,Height/4*4)
Y0=300
Y1=340
Fix1 = tfm(pp=0,slow=2)
Fix2 = tfm(pp=0,slow=2,y0=Y0,y1=Y1)
B1 = Fix1.ClipBlend
#B2 = Fix2.ClipBlend
return B1
if that does work (then problem in B2 side) [EDIT: or if dont then in B1 side]

Code:
FN="1941 Flint Michigan Parade [Low, 360p].mp4.AVI"
Avisource(FN)
Crop(0,0,Width/4*4,Height/4*4)
Y0=300
Y1=340
Fix1 = tfm(pp=0,slow=2)
Fix2 = tfm(pp=0,slow=2,y0=Y0,y1=Y1)
B2 = Fix2.ClipBlend
return B2
etc, where does the problem disappear ?

EDIT: Or start from what does work, until it does not, eg

return fix1, if ok, then return fix2, if ok then etc.

You have to at least attempt to help yourself, nobody else has your setup nor clip, nor problem.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th January 2018 at 17:30.
StainlessS is offline   Reply With Quote
Old 5th January 2018, 22:16   #11  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 365
I was assuming that something in this cryptic code was coded wrong by me. It has since occurred to me, wondering if the "SetMTMode(3,4)" I have at the top of my script (which I don't even think about any more) could be causing this.
TCmullet is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:59.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.