Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This is a first pass script, you don't need to encode it, just run it once from the beginning to the end via player or VDub. Don't seek while it is running.
- #It will dump all frames that are different into a folder along with timecodes file that will list all frames that are repeats of those dumped.
- ffmpegsource2("C:\Users\Seedmanc\Desktop\vector.mp4") # your source unprocessed video here
- ConvertToY8( ).coloryuv(autogain=true,opt="") .converttorgb24 # autocontrast since images looked rather dim for some reason
- global dir="c:\users\seedmanc\desktop\" # path to store images and logfile
- global filename="file.txt" # name of logfile
- function write(clip c, int s, int d){
- global o= string(s)
- global p=" "
- global r=string(s-d)
- writefile(c,dir+filename,"o","p","r",flush=false)
- }
- imagewriter(dir+"%d.png",start=0,end=-1,type="png").trim(0,-1)+trim(1,0)
- # writing 0th frame and number, since it is not considered a scene change, but we still need it
- writefilestart(last,dir+filename,""""TYPE int"""")
- writefilestart(last,dir+filename,""""DEFAULT 0"""",append=true) # header of the logfile
- global ext="png"
- global wildcard="%d."+ext
- global counter=-1
- ScriptClip("""a=current_frame"""+chr(13)+ \
- """(ConvertToY8.YDifferenceFromPrevious>10)? \
- ScriptClip(" counter=0 \
- write(last,a,counter) \
- imagewriter(dir+wildcard,start=current_frame,end=-1 ,info=false,type=ext)" ): \
- ScriptClip("counter=counter+1 write(last, a,counter)") """)
- # Basically, what I do here is detect scenechange (by looking at difference between previous frame and current and when it is above threshold of 10 I write current frame and save it's number so that it will be used later as reference.
- # If there's no change, then I don't write image, and don't change reference frame number.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement