mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-24 18:18:06 +00:00
Improved main queue, fixed pyscene don't showing with queue
This commit is contained in:
parent
d914bda20b
commit
f4bd47bb6a
4 changed files with 15 additions and 19 deletions
20
av1an.py
20
av1an.py
|
@ -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."""
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue