Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
detect-content --threshold 27.5
"""
#if intensity_cutoff is not None:
# raise NotImplementedError()
min_scene_len = parse_timecode(ctx.obj, min_scene_len)
logging.debug('Detecting content, parameters:\n'
' threshold: %d, min-scene-len: %d',
threshold, min_scene_len)
# Initialize detector and add to scene manager.
# Need to ensure that a detector is not added twice, or will cause
# a frame metric key error when registering the detector.
ctx.obj.add_detector(scenedetect.detectors.ContentDetector(
threshold=threshold, min_scene_len=min_scene_len))
def shotdetect(clip_dir, clip_path):
start = time.time()
scene_list = []
detector_list = [scenedetect.detectors.ContentDetector(threshold = 20)]
video_fps, frames_read = my_detect_scenes_file(clip_path, scene_list, detector_list, save_images = True)
scene_list_sec = [round((x) / float(video_fps), 3) for x in scene_list]
pyscene_timestamps = []
for item in scene_list_sec:
pyscene_timestamps.append(round(item - .01, 3))
pyscene_timestamps.append(round(item + .01, 3))
# create new list with scene boundaries in timecode strings ("HH:MM:SS.nnn").
# scene_list_tc = [scenedetect.timecodes.get_string(x) for x in scene_list_msec]
end = time.time()
print "Shots detected in %.3f!\n" %(end-start)
return scene_list_sec, pyscene_timestamps
def crap_detect(video_dir):
detector_list = [
scenedetect.detectors.ThresholdDetector(threshold=16, min_percent=0.6)
]
file_paths = gfile.Glob(os.path.join(video_dir, '*.avi'))
l = []
for file_path in file_paths:
try:
print(file_path)
scene_list = []
video_framerate, frames_read = scenedetect.detect_scenes_file(
file_path, scene_list, detector_list)
# scene_list now contains the frame numbers of scene boundaries.
print(l)
if len(scene_list) >= 1:
l.append(file_path)
except:
def scene_detect(videoPath):
sceneDetect = []
detector_list = [scenedetect.detectors.ThresholdDetector(threshold = 30, min_percent = 0.9)]
print videoPath
video_framerate, frames_read = scenedetect.detect_scenes_file(videoPath, sceneDetect, detector_list)
return sceneDetect