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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Nov 2008
Posts: 327
|
Gavino's: Delete frames satisfying user-defined condition
Hello,
http://forum.doom9.org/showthread.php?t=163107 This works so very well but I would like it to delete the original as well as the duplicate (don't ask!). Is that possible? Thanks. |
|
|
|
|
|
#2 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
|
Can you be more specific in requirement,
you want to delete START (where START is frame before 1st dupe) and 1st dupe only, or START + ALL following dupes ? EDIT: Ignore Above, its rubbish EDIT: NOTE, potential problem in linked script function is that it only compares dupes with the previous frame, and not with the START frame, so could delete low motion sequences. You could try this, (untested), deletes START + all dupes not just first. Code:
DeleteFrames("YDifferenceToNext < 0.1 && current_frame < fc-1")
__________________
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; 26th November 2015 at 08:38. |
|
|
|
|
|
#3 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
|
I guess above question was a bit stupid
, you would end up deleting multiple pairs of dupes if not deleting all dupes in run.How bout this Code:
Function DeleteCompleteDupeRun(clip c,float "th",Bool "Debug") {
# Delete dupe START frame plus all following dupes.
# Dupes compared with run START frame rather than DupeFrame-1
# Req RT_Stats + GSCript.
myName="DeleteCompleteDupeRun: "
c
th=Float(Default(th,0.1)) Debug=Default(Debug,False)
res = BlankClip(c, length=0)
fc = FrameCount() fmx=fc-1
GSCript("""
n = 0
while(n < fc) {
DelS=n
while(n<fmx && RT_LumaDifference(Last,Last,n=DelS,n2=n+1) < th) { # YDifference To run START frame
n = n + 1
}
if(n>DelS) {
(Debug)?RT_DebugF("Deleting %d to %d",DelS,n,name=myName):NOP
n = n + 1 # Point @ start keep frame
}
if(n < fc) { # not at end
KeepS = n # start of wanted section
while((n<fmx && RT_YDifference(Last,n=n,delta=1) >= th) || n==fmx) { # YDifferenceToNext
n = n + 1
}
(Debug)?RT_DebugF("Keeping %d to %d",KeepS,n-1,name=myName):NOP
res = res + Trim(KeepS, KeepS-n)
}
}
""")
return res
}
ColorBars.ConvertToYV12.Killaudio
A=Trim(0,-1)
B=A.FlipHorizontal
C=A.Flipvertical
A=A.Subtitle("A")
B=B.Subtitle("B")
C=C.Subtitle("C")
#A+A # Del 0-1 == No Frames
#A+B # Keep 0-1 == AB
#A+B+C+ A+A+A +B+C+A # keep 0-2, Del 3-5, keep 6-8 == ABCBCA
#A+B+C+ A+A+A +B+C+C # keep 0-2, Del 3-5, keep 6, Del 7-8 == ABCB
A+B+C+ A+A+A +B # keep 0-2, Del 3-5, keep 6 == ABCB
DeleteCompleteDupeRun(0.1,Debug=True)
__________________
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 ??? |
|
|
|
|
|
#5 | Link | |
|
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,442
|
Quote:
I think it can also be done using my original generic DeleteFrames function by extending the supplied condition to be: Code:
DeleteFrames("(YDifferenceFromPrevious < 0.1 && current_frame > 0)
\ || (YDifferenceToNext < 0.1 && current_frame < fc-1)")
Last edited by Gavino; 26th November 2015 at 19:48. Reason: fixed errors - thanks, raffriff42 |
|
|
|
|
|
|
#10 | Link | |
|
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,442
|
Quote:
Should have tested it - I must be getting rusty. ![]() Original post edited (again!) |
|
|
|
|
|
|
#11 | Link | |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
|
Quote:
![]() EDIT: With long run of (EDIT: Localized) low motion, my version might output eg ddkddkddkddkddk instead of (d=del, k=keep) ddddddddddddddd due to comparisons with START frame rather than DupeFrame-1.
__________________
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; 26th November 2015 at 20:23. |
|
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Nov 2008
Posts: 327
|
Now I'm finding that on regular occasions I need to delete yet another frame.
My clip has some nasty blending (Kinescope with phase errors) at scene changes: A, A/B, B/A, damaged B, B. If I run John Meyers' scene change detection script I get: A, A, A, damaged B, B. Then after Stainless/Gavino's script: A, damaged B, B. So, does anyone have any idea for removing "damaged B"? TBH its all a bit above me, I don't know how Gavino's script does what it does. Wish I had a brain! Thanks for all the help. |
|
|
|
|
|
#13 | Link |
|
Retried Guesser
Join Date: Jun 2012
Posts: 1,371
|
You need to define 'damaged' in Avisynth terms...
Does 'Kinescope with phase errors' mean the colors are wonky? Then try Code:
DeleteFrames("(YDifferenceFromPrevious < 0.1 && current_frame > 0)
\ || (YDifferenceToNext < 0.1 && current_frame < fc-1)"
\ || (UDifferenceToNext > 42 && current_frame < fc-1)")
- YDifferenceToNext tests luminance (brightness) - UDifferenceToNext tests color on the blue-yellow axis - VDifferenceToNext tests color on the red-green axis Threshold level "42" was chosen at random. Try different values. EDIT thx StainlessS, please remove the red quote. Last edited by raffriff42; 26th November 2015 at 23:15. |
|
|
|
|
|
#14 | Link | ||
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
|
RaffRiff, you got too many quotes in there ? (middle line)
Not related to previous Floatingshed post, here func for deleting dupes not-including START of run (just duplicates), Dupes compared with inital START of run frame rather than DupeFrame-1. Code:
Function DeleteDupRun(clip c,float "th",Bool "Debug") {
# Delete all dupes (leaving initial START frame [of which dupes are a copy]).
# Dupes compared with run START frame rather than DupeFrame-1
# Req RT_Stats + GSCript.
myName="DeleteDupRun: "
c
th=Float(Default(th,0.1)) Debug=Default(Debug,False)
res = BlankClip(c, length=0)
fc = FrameCount() fmx=fc-1
GSCript("""
n = 0
while(n < fc) {
DupS=n # n - 1 is START (if n != 0)
while(n<fc && n>0 && RT_LumaDifference(Last,Last,n=DupS-1,n2=n) < th) {
n = n + 1
}
if(DupS<n) { # DupS < n if we are deleting some
(Debug)?RT_DebugF("Deleting %d to %d",DupS,n-1,name=myName):NOP
}
if(n < fc) { # not at end
KeepS = n # start of wanted section
n = n + 1
while(n<fc && RT_YDifference(Last,n=n,delta= -1) >= th) { # YDifference From Previous
n = n + 1
}
# Exit here with n == Dupe Seq START frame + 1 (or fc)
(Debug)?RT_DebugF("Keeping %d to %d",KeepS,n-1,name=myName):NOP
res = res + Trim(KeepS, KeepS-n)
}
}
""")
return res
}
ColorBars.ConvertToYV12.Killaudio
A=Trim(0,-1)
B=A.FlipHorizontal
C=A.Flipvertical
A=A.Subtitle("A")
B=B.Subtitle("B")
C=C.Subtitle("C")
#A+A # Keep 0-0, Del 1-1 == A
#A+B # Keep 0-1 == AB
#A+B+C+ A+A+A +B+C+A # keep 0-3, Del 4-5, keep 6-8 == ABCABCA
#A+B+C+ A+A+A +B+C+C # keep 0-3, Del 4-5, keep 6-7, Del 8 == ABCABC
A+B+C+ A+A+A +B # keep 0-3, Del 4-5, keep 6 == ABCAB
DeleteDupRun(0.1,Debug=True)
EDIT: Quote:
also because its part of RaffRiff42's moniker. (random my foot). EDIT: From Below post, Quote:
![]() EDIT: 42, Life, the Universe, and Everything:- http://www.independent.co.uk/life-st...g-2205734.html https://www.youtube.com/watch?v=aboZctrHfK8 http://www.theguardian.com/books/201...-42-hitchhiker EDIT: The Movie, (The Hitch Hiker's Guide To The Galaxy) is quite naff compared to original TV series or even the World Service radio broadcasts. (I've got both TV series and Movie on DVD, only had the stomach to watch the movie about twice, like many/most US backed re-makes of British classics, result is garbage, US producers seem to presume that their audience is stupid) EDIT: The YouTube clip linked above, is the naff Movie version.
__________________
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; 29th November 2015 at 15:35. |
||
|
|
|
|
|
#16 | Link |
|
Registered User
Join Date: Nov 2008
Posts: 327
|
'Kinescope with phase errors'.. is not a colour problem, the footage is B&W.
Phase errors in this case refers to the alignment of the tv fields with the film frames. A situation where a single frame of film can contain field B of a tv frame blended with field A of the next. Here is an example, not one of the worst by any means. https://www.mediafire.com/?p85f5sar45autrw Last edited by Floatingshed; 26th November 2015 at 23:54. |
|
|
|
|
|
#17 | Link | |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
|
FloatingShed, cant you just eg convert toYV24/YUY2, AssumeTFF/AssumeBFF, SeparateFields, delete first field, weave, to match up like fields.
... Having looked at Exotic Interlacing by ScharfisBrain see below (See Mediafire in my sig, DATA folder for Exotic Interlacing in English), Quote:
__________________
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; 27th November 2015 at 00:39. |
|
|
|
|
|
|
#19 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,418
|
FS, you got a bit bigger sample, ~30MB please (audio not necessary).
EDIT: With a few of scene cuts.
__________________
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 ??? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|