View Single Post
Old 25th November 2020, 22:05   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
PDR script would probably do you, but I already did this.

Code:
# Requires AVS+, RT_Stats for outlog : Use maybe AvsMeter to scan clip and produce log, or VDub2 Video Analysis Pass
# Can show DebugView to see results in real time.

AviSource(".\Sample2.mkv.AVI")                      # Your clip, maybe some other source filter

####### DEMO Make Bad Frame # Comment out this block for real clip, this just to test if works
#Part_1 = Trim(0,-1000)             # 1000, frames
#Part_2 = Trim(1000,0)              # Remainder
#Bad_Frame = Trim(0,-1)             # Use FIRST Frame as Bad Frame
#Part_1 ++ Bad_Frame ++ Part_2      # Splice with BAD frame inserted at frame 1000 (length is now original length + 1)
####### END  DEMO Make Bad Frame ############

### User Config ###
LOG = ".\MyLog.Log"                                 # Log in current dir
DEBUG=False                                         # Output all numbers to DebugView (Google)
MyName = "HDVProjection: "                          # Name flagged in DebugView
THRESH = 20.0                                       # Prev<->Curr and Curr<->Next Must be higher than THRESH for BAD Detect

############
RT_FileDelete(LOG)

SSS="""
    n = current_frame                               # Rem current frame
    if(0 < n < FrameCount-1) {
        current_frame = n - 1                       # Point at Previous frame (n-1)
        Prev = YDifferenceToNext                    # Diff between Previous Frame and current frame, dif(n-1 , n)
        Alt  = YDifferenceToNext(Offset=2)          # Diff between Prev and Next Frame (either side of current_frame), dif(n-1 , n+1)
        current_frame = n                           # Restore current_frame
        Next = YDifferenceToNext                    # Diff between current frame and Next frame. dif(n , n+1)
        if(DEBUG) {
            RT_DebugF("%d] Prev=%f Next=%f Alt=%f",n,Prev,Next,Alt,name=myName)
        }
        if(Prev > THRESH && Next > THRESH && (Alt < Prev || Alt < Next)) {           # Flag current frame for inspection
            RT_WriteFile(LOG,"%d",n,Append=True)                                     # I dont offhand know how to use new AVS+ log funcs.
            RT_DebugF("%d] *** Prev=%f Next=%f Alt=%f",n,Prev,Next,Alt,name=myName)  # Output to DebugView even if DEBUG=False
        }
    }
    Return Last
"""

Return ScriptClip(SSS)
EDIT: Modified a bit, small functional difference.

EDIT: Outputs this to DebugView for demo BAD frame @ 1000
Code:
00002755	20:57:13	[4792] HDVProjection: 1000] Prev=68.198410 Next=68.360115 Alt=10.026074
Also outputs 1000, to MyLog.Log.

EDIT:
Code:
&& Alt < Prev && Alt < Next
Should cut out almost all false +ve's
Can set DebugView HighLight filter to ":" to only show our debugview messages.
(other programs/drivers/anti malware, may be sending stuff to debugVew window)
__________________
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 2020 at 13:54.
StainlessS is offline   Reply With Quote