View Single Post
Old 9th August 2017, 01:20   #30  |  Link
VS_Fan
Registered User
 
Join Date: Jan 2016
Posts: 98
Quote:
Originally Posted by lansing View Post
How do I get all the frame numbers of the start of the scene change?
This should do the trick:
Code:
import vapoursynth as vs
core = vs.get_core()

ret = core.ffms2.Source(source="video file name")

#ret = core.scd.Detect(clip=ret, thresh=40, log="SC_SCD.TXT")#, interval_h, interval_v)
ret = core.misc.SCDetect(clip=ret, threshold=0.15)

fstats = open ('SC.txt', 'w', encoding='utf-8', errors='strict')
fstats.write('frame_no\n')
for i in range (ret.num_frames):
    if ret.get_frame(i).props._SceneChangePrev == 1 :
        fstats.write('{}\n'.format(i))
fstats.close()

ret=core.text.FrameProps(clip=ret, alignment=3)#, props
ret.set_output()
It will scan the whole video, create the 'SC.txt' text file, write to it the list of frames detected by the misc.SCDetect filter as start of a scene change, then it will close the file when finished and only after that it will show any video if run from vsedit.

So give it a while, and when it finishes, rename or copy your new 'SC.txt' text file with the frame numbers to avoid rewritting it.
VS_Fan is offline   Reply With Quote