unsilence.lib.render_media.RenderIntervalThread

Module Contents

Classes

RenderIntervalThread

Worker thread that can render/process intervals based on defined options

class unsilence.lib.render_media.RenderIntervalThread.RenderIntervalThread(thread_id, input_file: pathlib.Path, render_options: types.SimpleNamespace, task_queue: queue.Queue, thread_lock: threading.Lock, **kwargs)

Bases: threading.Thread

Worker thread that can render/process intervals based on defined options

Initializes a new Worker (is run in daemon mode) :param thread_id: ID of this thread :param input_file: The file the worker should work on :param render_options: The parameters on how the video should be processed, more details below :param task_queue: A queue object where the worker can get more tasks :param thread_lock: A thread lock object to acquire and release thread locks :param kwargs: Keyword Args, see below for more information

run()

Start the worker. Worker runs until stop() is called. It runs in a loop, takes a new task if available, and processes it :return: None

stop()

Stops the worker after its current task is finished :return:

__render_interval(interval_output_file: pathlib.Path, interval: unsilence.lib.intervals.Interval.Interval, apply_filter=True, drop_corrupted_intervals=False, minimum_interval_duration=0.25)

Renders an interval with the given render options :param interval_output_file: Where the current output file should be saved :param interval: The current Interval that should be processed :param apply_filter: Whether the AV-Filter should be applied or if the media interval should be left untouched :param drop_corrupted_intervals: Whether to remove corrupted frames from the video or keep them in unedited :return: Whether it is corrupted or not

__generate_command(interval_output_file: pathlib.Path, interval: unsilence.lib.intervals.Interval.Interval, apply_filter: bool, minimum_interval_duration: float)

Generates the ffmpeg command to process the video :param interval_output_file: Where the media interval should be saved :param interval: The current interval :param apply_filter: Whether a filter should be applied or not :return: ffmpeg console command

static clamp_speed(duration: float, speed: float, minimum_interval_duration=0.25)