dejenson

dejensonify - Remove annoying pauses from presentation videos.

dejenson.transcriber

Audio transcription using Whisper.

extract_timestamps

def extract_timestamps(video_path: Path,
                       model_name: str = "base") -> list[dict]

Extract word-level timestamps from a video using Whisper.

Arguments:

Returns:

List of word dictionaries with ‘word’, ‘start’, and ‘end’ keys

save_timestamps

def save_timestamps(words: list[dict], output_path: Path) -> None

Save word timestamps to a JSON file.

load_timestamps

def load_timestamps(input_path: Path) -> list[dict]

Load word timestamps from a JSON file.

dejenson.cli

Command-line interface for dejensonify.

main

def main()

Main entry point for the dejensonify CLI.

dejenson.downloader

Video downloading using yt-dlp.

download_video

def download_video(url: str, output_dir: Path) -> Path

Download a video using yt-dlp.

Arguments:

Returns:

Path to the downloaded video file

dejenson.gap_detector

Detect gaps/pauses in word timestamps.

find_gaps

def find_gaps(words: list[dict],
              max_gap: float = 0.2) -> list[tuple[float, float]]

Find gaps between words that exceed the maximum gap threshold.

Arguments:

Returns:

List of (start, end) tuples representing gaps to remove

calculate_keep_segments

def calculate_keep_segments(
        words: list[dict],
        max_gap: float = 0.2,
        video_duration: float | None = None) -> list[tuple[float, float]]

Calculate video segments to keep (inverse of gaps).

Extends segments into gaps by half the max_gap threshold on each side to avoid cutting off breaths, trailing sounds, etc due to Whisper timestamp inaccuracies.

Arguments:

Returns:

List of (start, end) tuples representing segments to keep

dejenson.video_editor

Video editing using ffmpeg.

get_video_duration

def get_video_duration(video_path: Path) -> float

Get the duration of a video file in seconds.

Arguments:

Returns:

Duration in seconds

cut_segments

def cut_segments(video_path: Path,
                 segments: list[tuple[float, float]],
                 output_path: Path,
                 work_dir: Path | None = None) -> None

Cut video segments using ffmpeg select filter in a single pass.

Arguments: