Skip to main content

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

# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt update
sudo apt install ffmpeg

# Python deps
uv sync

Local execution

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

The command prints the generated manifest path when processing succeeds.

Tests

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

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 and publishing

The distribution is published to PyPI as drama-slicer, while the Python import package remains slicer.

See docs/PUBLISHING.md for the complete versioning, testing, build, credential, publishing, and installation-verification process.

0.1.2 双语字幕入口

新业务从根包导入 analyze_video、slice_video,默认先确认源片硬字幕风险。英语文本软字幕优先于 Whisper,输出 slicer.slice_set.v2;中英文使用共享 cue 时间,支持位置与词跨度。完整调用、系统依赖、旧入口兼容和检测限制见 字幕契约。

Metadata

Release files for drama-slicer 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drama-slicer 0.1.2
File Size Uploaded
drama_slicer-0.1.2.tar.gz 214.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drama-slicer 0.1.2
File Interpreter ABI Platform
drama_slicer-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 234.5 kB

Release files / drama_slicer-0.1.2.tar.gz

Download URL drama_slicer-0.1.2.tar.gz
Size 214.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f05cf5dfbe14ec525704e43129ae9af2933fbc95103a8dd02fda93e71a39e24d
BLAKE2b-256 checksum
How to use checksums
ad56e20d78a6ea950b24f98c7ce3667a5017f0103f3cfcb99f95a6a27a6007ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / drama_slicer-0.1.2-py3-none-any.whl

Download URL drama_slicer-0.1.2-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76b4d1bf9641776366f11c73eb5139a514c833c43e527f95b9b68c46e32d0b18
BLAKE2b-256 checksum
How to use checksums
cb4f1b9f7de21d4dd74b1e643e1bc26af7c4305676fe9a20184ccf4bb89e8fc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page