hi, i'm working on some video where I would like to remove a previous frame and say 4 or 5 frames afterwards, but i can't seem to get my head around adding those addition frames to the deleted frames list and how to delete 1 frame prior frame here's my script so far AviSource("F:\Work\Latest\First Day At School 24\Black_drops_sample_huffy.avi").converttoYV12() # change this to your video filename threshold = 100# change this value to suit requirements #ScriptClip(""" Subtitle(string(current_frame) + " - " + String(AverageLuma())) """) # uncomment this line to display frame numbers and averageluma values. # now remove all frames darker than your set threshold from your video offset = 0 ScriptClip(""" offset = offset + DarkFrames(Trim(offset, 0), current_frame, threshold) #offset contains number of frames to be cut Trim(offset, 0) #0 pad audio """) # now cut out additional frames after offset #create another function with different AvergeLuma(c) conditions function DarkFrames(clip c, int current_frame, int thresh) { # this function returns the number of consecutive 'dark' frames at the current frame AverageLuma(c) > thresh ? 0 \ : (current_frame >= c.frameCount-1) ? 1 \ : 1 + DarkFrames(c.Trim(1,0), current_frame, thresh) #add one frame at a time to list using trim(1,0) with padding } any help please :thanks:
so on my avi captures, one frame prior to the drop out is bad and averageluma doesn't detect it, and after the function DarkFrames() does its job about 4 or 5 frames are bad and I would like to remove those as well
Post a sample. Some links: Delete frames satisfying user-defined condition:- Gavino's: Delete frames satisfying user-defined condition :- Blend duplicate frames? :- Another frame duplication function :- Auto drop dark frames:- Automatically fix dups followed (eventually) by drops :- Filter to remove duplicate frames:- automated framedrop filler script :):-
this is the one im working off Auto drop dark frames:- Single_Frame_Previous_sample.avi previous_frame_to_delete1.bmp previous frame to delete in my capture most of the time I get this frame before a frame drop, which averageluma() doesn't pick up because its set to a different threshold then after the darkframe() function i'm left with these junk frames I would also like to delete, i've tried modifying the script but i've had no luck in adding code to automatically delete the previous frame and he 3,4 junk frames left over example files Black_drops_sample.avi after_filter_delete_frames0.bmp - after_filter_delete_frames8.mp sample videos: Pictures:
the DarkFrames() works as it should its just I would like to add to the function to also delete the 1 previous frame and and left over frames afterwards
in regard to previous frame 1.bmp or Single_Frame_Previous_Sample.avi, how do I remove that automatically? it the moment im doing frame by frame editing in VirtrualdubMod but I would like these frames deleted also automatically any help would be appreciated
------------------------------ ///M3 '98 Estoril Blue / Dove Grey '03.5 Carbon Black / Cinnamon
not working properly yet, i'm not sure what im doing wrong i'm uploading the processed video atm here's the script so far: #Setmemorymax(512) ############################################################################### LoadPlugin("C:\Video-tools\avisynth 2.5\plugins\FrameSel.dll") LoadPlugin("C:\Video-tools\avisynth 2.5\plugins\Prune.dll") LoadPlugin("C:\Video-tools\avisynth 2.5\plugins\RT_Stats.dll") LoadPlugin("C:\Video-tools\avisynth 2.5\plugins\GScript.dll") ############################################################################### #DirectShowSource("F:\Video-Capture\First Day At School 24.avi").converttoYV12() #for Win64 AVISource("D:\Temp\Video-edit2\Dropped Frames\Question\Black_drops_sample.avi").converttoYV12().killaudio #Colorbars.ConvertToYV12.killAudio A=Trim(0,-100) B=A.Levels(16,1.0,235,16,50,Coring=false) A++B++A GreyMouse(Last,DelPre=10,delPost=20) Function GreyMouse(clip c, Float "Th",Int "delPre",Int "delPost",String "FramesFile") { # Does NOT return until FramesFile created. # Req RT_Stats, GScript(c) Gavino. c Th = Float(Default(Th, 64.0)) # AverageLuma <= Th ==== DARK delPre = Default(delPre, 0) # Number of frames to drop before first dark one delPost = Default(delPost, 0) # Number of frames to drop after last dark one FramesFile = Default(FramesFile, "Frames.txt") # Output file RT_GetFullPathName(FramesFile) RT_FileDelete(FramesFile) GSCript(""" c FC=FrameCount WrE = -1 for(i=0,FC-1) { if(RT_AverageLuma(n=i) <= Th) { sLight=FC for(j=i+1,FC-1) { if(RT_AverageLuma(n=j) > Th) { sLight = j j = FC # Break } } WrS = Max(WrE+1,i-delPre) WrE = Min(sLight-1+delPost,FC-1) RT_WriteFile(FramesFile,"%d,%d",WrS,WrE,Append=True) i=WrE # Next i iteration continue at WrE + 1 } } """) return c #Return MessageClip("FrameFile Created") } Function RejectRanges(clip c,String "SCmd",String "Cmd",Bool "TrimAudio",Float "FadeMS") { # RejectRanges() by StainlessS. Required:- FrameSel, Prune, RT_Stats # Wrapper to delete frames/ranges along with audio, can supply frames/ranges in SCmd string And/Or Cmd file. # The wrapper makes for easier usage of Prune() which supports up to 256 input clips, but requires a clip index, # eg '3, 100,200' would specify clip 3, range 100 to 200. The wrapper does away with the necessity for the clip index as we # are only using a single clip here. Prune also does not have a 'reject' arg to delete specified frames rather than select them, # this wrapper also converts a list of frames to delete into a list of frames to select so that we can use Prune and its audio # capability. # # SCmd: Frames/Ranges specified in String (Frames/Ranges either Chr(10) or ';' separated, infix ',' specifies range, eg 'start,end'). # Cmd: Frames/Ranges specified in file (one frame/range per line, comments also allowed, see FrameSel for Further info). # TrimAudio: # True(default), deletes audio belonging to deleted frames # False, returns original audio, probably out of sync. # FadeMS: (default 1.0 millisec). Linear Audio Fade duration at splices when TrimAudio==true, 0 = dont fade (might result in audio 'clicks/cracks'). c TrimAudio=Default(TrimAudio,True) # default true trims audio, false returns original audio (audiodubbed, as Framesel returns no audio) FadeMS=Float(Default(FadeMS,1.0)) # 1 millisecond linear fadeout/fadein at splices PruneCmd = (TrimAudio) ? "~Prune_"+RT_LocalTimeString+".txt" : "" (!TrimAudio) \ ? FrameSel(scmd=SCmd,cmd=Cmd,reject=true) \ : FrameSel_CmdReWrite(PruneCmd,scmd=SCmd,cmd=Cmd,reject=true,Prune=True,range=true) (TrimAudio) ? Prune(Cmd=PruneCmd,FadeIn=True,FadeSplice=True,FadeOut=True,Fade=FadeMS) : NOP # If TrimAudio==true then delete Prune temp file, Else restore original Audio to the now audio-less clip (TrimAudio) \ ? RT_FileDelete(PruneCmd) \ : (c.HasAudio) ? AudioDub(c) : NOP Return Last }
it does create frames.txt as well frames.txt has 58,219 258,299 in it
------------------------------ This message brought to you by the society for knowing what you're talking about when you post. Omega8: The smartest peanut in the turd