Metadata-Version: 2.5
Name: drama-slicer
Version: 0.1.1
Summary: Transcript-aware video and audio slicing library
Requires-Python: >=3.11
Requires-Dist: whisperx==3.8.5
Description-Content-Type: text/markdown

# drama-slicer

Python library and backend-callable API for processing video/audio files into transcript-aware video `Slice` objects.

Install the published package with `uv add drama-slicer` or `pip install drama-slicer`.
The distribution name is `drama-slicer`; the Python import package remains `slicer`.

## Preparation

```shell
# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt update
sudo apt install ffmpeg

# Python deps
uv sync
```

## Local execution

```shell
uv run src/main.py data/input/Popeye_forPresident_512kb.mp4
```

The command prints the generated manifest path when processing succeeds.

## Tests

```shell
uv --cache-dir /private/tmp/uv-cache run python -m unittest discover -s tests
```

The test suite uses real `ffprobe`, `ffmpeg`, and WhisperX execution. The end-to-end test verifies that all slices continuously cover the original video duration.
Test outputs are grouped under `data/output/tests/<video-name>/`.
Repeated exports replace previous manifest and slice files for the same video name.

## Python API

```python
from slicer import slice_video_to_output

manifest_path = slice_video_to_output(
    "data/input/Popeye_forPresident_512kb.mp4",
    output_dir="data/output",
    include_video=True,
)
```

`slice_video_to_output()` is the only public Python API. It uses local WhisperX to generate transcript timestamps, builds continuous slices that cover the original video timeline, and writes the result to disk. Other modules, models, and helper functions are internal implementation details.

Output format:

- `data/output/<video-name>/*_manifest.json`: index of all slices, timestamps, text files, optional video files, and sentence data.
- `data/output/<video-name>/*_slice_0000_00000_000-00012_000.txt`: transcript lines for each slice.
- `data/output/<video-name>/*_slice_0000_00000_000-00012_000.mp4`: video slice when `include_video=True`, which is the default for `slice_video_to_output()`.

## Packaging
```shell
uv build
```
