unsilence.lib.render_media.MediaRenderer

Module Contents

Classes

MediaRenderer

The Media Renderer handles the rendering of Intervals objects, so it processes the complete video and concatenates

class unsilence.lib.render_media.MediaRenderer.MediaRenderer(temp_path: pathlib.Path)

The Media Renderer handles the rendering of Intervals objects, so it processes the complete video and concatenates the different intervals at the end

Initializes a new MediaRenderer Object :param temp_path: The temp path where all temporary files should be stored

render(input_file: pathlib.Path, output_file: pathlib.Path, intervals: unsilence.lib.intervals.Intervals.Intervals, **kwargs)

Renders an input_file and writes the final output to output_file :param input_file: The file that should be processed :param output_file: Where the processed file should be saved :param intervals: The Intervals that should be processed :param kwargs: Keyword Args, see below :return: None

kwargs:

audio_only: Whether the output should be audio only (bool) audible_speed: The speed at which the audible intervals get played back at (float) silent_speed: The speed at which the silent intervals get played back at (float) audible_volume: The volume at which the audible intervals get played back at (float) silent_volume: The volume at which the silent intervals get played back at (float) drop_corrupted_intervals: Whether corrupted video intervals should be discarded or tried to recover (bool) threads: Number of threads to render simultaneously (int > 0) on_render_progress_update: Function that should be called on render progress update

(called like: func(current, total))

on_concat_progress_update: Function that should be called on concat progress update

(called like: func(current, total))

static __concat_intervals(file_list: list, concat_file: pathlib.Path, output_file: pathlib.Path, update_concat_progress)

Concatenates all interval files to create a finished file :param file_list: List of interval files :param concat_file: Where the ffmpeg concat filter file should be saved :param output_file: Where the final output file should be saved :param update_concat_progress: A function that is called when a step is finished

(called like function(current, total))

Returns

None