Improved main queue, fixed pyscene don't showing with queue

This commit is contained in:
Zen 2020-07-06 20:08:23 +03:00
parent d914bda20b
commit f4bd47bb6a
4 changed files with 15 additions and 19 deletions

View file

@ -282,7 +282,7 @@ class Av1an:
# inherit video params from aom encode unless we are using a different encoder, then use defaults
aom_keyframes_params = self.video_params if (self.encoder == 'aom') else AOM_KEYFRAMES_DEFAULT_PARAMS
framenums = split_routine(self.input, self.scenes, self.split_method, self.temp, self.min_scene_len, self.queue, self.threshold, self.ffmpeg_pipe, aom_keyframes_params)
framenums = split_routine(self.input, self.scenes, self.split_method, self.temp, self.min_scene_len, self.threshold, self.ffmpeg_pipe, aom_keyframes_params)
if self.extra_split:
framenums = extra_splits(self.input, framenums, self.extra_split)
@ -320,19 +320,19 @@ class Av1an:
def main_queue(self):
# Todo: Redo Queue
tm = time.time()
self.queue, self.input = process_inputs(self.input)
if self.queue:
for file in self.queue:
tm = time.time()
self.input = file
self.queue = process_inputs(self.input)
for file in self.queue:
tm = time.time()
self.input = file
if len(self.queue) > 1:
print(f'Encoding: {file}')
self.output_file = None
self.video_encoding()
print(f'Finished: {round(time.time() - tm, 1)}s\n')
else:
self.video_encoding()
print(f'Finished: {round(time.time() - tm, 1)}s')
print(f'Finished: {round(time.time() - tm, 1)}s\n')
def main_thread(self):
"""Main."""

View file

@ -7,7 +7,7 @@ from scenedetect.video_manager import VideoManager
from .logger import log
def pyscene(video, threshold, progress_show, min_scene_len):
def pyscene(video, threshold, min_scene_len):
"""
Running PySceneDetect detection on source video for segmenting.
Optimal threshold settings 15-50
@ -30,7 +30,7 @@ def pyscene(video, threshold, progress_show, min_scene_len):
# Start video_manager.
video_manager.start()
scene_manager.detect_scenes(frame_source=video_manager, show_progress= not progress_show)
scene_manager.detect_scenes(frame_source=video_manager, show_progress=True)
# Obtain list of detected scenes.
scene_list = scene_manager.get_scene_list(base_timecode)

View file

@ -85,7 +85,7 @@ def extra_splits(video, frames: list, split_distance):
return result
def split_routine(video, scenes, split_method, temp, min_scene_len, queue, threshold, ffmpeg_pipe, video_params):
def split_routine(video, scenes, split_method, temp, min_scene_len, threshold, ffmpeg_pipe, video_params):
if scenes == '0':
log('Skipping scene detection\n')
@ -106,7 +106,7 @@ def split_routine(video, scenes, split_method, temp, min_scene_len, queue, thres
if split_method == 'pyscene':
log(f'Starting scene detection Threshold: {threshold}, Min_scene_length: {min_scene_len}\n')
try:
sc = pyscene(video, threshold, queue, min_scene_len)
sc = pyscene(video, threshold, min_scene_len)
except Exception as e:
log(f'Error in PySceneDetect: {e}\n')
print(f'Error in PySceneDetect{e}\n')

View file

@ -44,11 +44,7 @@ def process_inputs(inputs):
print(f'File(s) do not exist: {", ".join([str(inputs[i]) for i in np.where(not valid)[0]])}')
terminate()
if len(inputs) > 1:
return inputs, None
else:
return None, inputs[0]
return inputs
def get_keyframes(file: Path):
"""