unsilence.Unsilence

Module Contents

Classes

Unsilence

Unsilence Class to remove (or isolate or many other use cases) silence from audible video parts

class unsilence.Unsilence.Unsilence(input_file: pathlib.Path, temp_dir: pathlib.Path = Path('.tmp'))

Unsilence Class to remove (or isolate or many other use cases) silence from audible video parts

Parameters
  • input_file (Path) – The file that should be processed

  • temp_dir (Path) – The temp dir where temporary files can be saved

detect_silence(**kwargs)

Detects silence of the file (Options can be specified in kwargs)

Parameters

**kwargs – Remaining keyword arguments are passed to detect_silence()

Returns

A generated Intervals object

Return type

Intervals

set_intervals(intervals: unsilence.lib.intervals.Intervals.Intervals)

Set the intervals so that they do not need to be re-detected

Parameters

intervals (Intervals) – Intervals collection

Returns

None

get_intervals()

Get the current Intervals so they can be reused if wanted

Returns

Intervals collection

Return type

Intervals

estimate_time(audible_speed: float = 1, silent_speed: float = 6)

Estimates the time (savings) when the current options are applied to the intervals

Parameters
  • audible_speed (float) – The speed at which the audible intervals get played back at

  • silent_speed (float) – The speed at which the silent intervals get played back at

Raises

ValueError – If silence detection was never run

Returns

Dictionary of time information

Return type

dict

render_media(output_file: pathlib.Path, **kwargs)

Renders the current intervals with options specified in the kwargs

Parameters
  • output_file (Path) – Where the final file should be saved at

  • **kwargs – Remaining keyword arguments are passed to render()

Returns

None

cleanup()

Cleans up the temporary directories, called automatically when the program ends

Returns

None