Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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:
pass
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
# it's tightly coupled to the command line arguments passed by scenedetect.cli
# TODO: Rewrite the necessary PySceneDetect functions so they aren't retarded.
# or write my own detector that stops after finding a match, see detect_threshold
scene_detectors = scenedetect.detectors.get_available()
args = DumbNamespace(threshold=threshold,
detection_method='content',
downscale_factor=2,
start_time=[0, start_minutes, 0],
duration=[0, end_minutes, 0],
quiet_mode=True,
# end custom arguments, begin defaults
min_scene_len=15,
frame_skip=0)
scene_manager = scenedetect.manager.SceneManager(args=args, scene_detectors=scene_detectors)
video_fps, frames_read, frames_processed = scenedetect.detect_scenes_file(path, scene_manager)
scene_list_sec = [x / float(video_fps) for x in scene_manager.scene_list]
return scene_list_sec[0]