Metadata-Version: 2.5
Name: twat-video
Version: 2.7.8
Summary: Video processing helpers for the twat plugin ecosystem
Project-URL: Documentation, https://github.com/twardoch/twat-video#readme
Project-URL: Issues, https://github.com/twardoch/twat-video/issues
Project-URL: Source, https://github.com/twardoch/twat-video
Author-email: Adam Twardoch <adam+github@twardoch.com>
License-Expression: MIT
License-File: LICENSE
Keywords: ffmpeg,media,twat-plugin,video
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: fire>=0.5.0
Requires-Dist: twat>=1.8.1
Provides-Extra: all
Requires-Dist: build>=0.10.0; extra == 'all'
Requires-Dist: hatch-vcs>=0.4.0; extra == 'all'
Requires-Dist: hatchling>=1.27.0; extra == 'all'
Requires-Dist: mkdocs-material>=9.5.56; extra == 'all'
Requires-Dist: mkdocs>=1.6.1; extra == 'all'
Requires-Dist: mkdocstrings[python]>=0.28.0; extra == 'all'
Requires-Dist: mypy>=1.0.0; extra == 'all'
Requires-Dist: pre-commit>=3.6.0; extra == 'all'
Requires-Dist: pymdown-extensions>=10.14; extra == 'all'
Requires-Dist: pytest-benchmark[histogram]>=4.0.0; extra == 'all'
Requires-Dist: pytest-cov>=4.0.0; extra == 'all'
Requires-Dist: pytest-xdist>=3.5.0; extra == 'all'
Requires-Dist: pytest>=7.0.0; extra == 'all'
Requires-Dist: ruff>=0.1.0; extra == 'all'
Requires-Dist: twine>=4.0.0; extra == 'all'
Provides-Extra: binary
Requires-Dist: cx-freeze>=6.15.0; extra == 'binary'
Requires-Dist: pyinstaller>=6.0.0; extra == 'binary'
Provides-Extra: build
Requires-Dist: build>=0.10.0; extra == 'build'
Requires-Dist: hatch-vcs>=0.4.0; extra == 'build'
Requires-Dist: hatchling>=1.27.0; extra == 'build'
Requires-Dist: twine>=4.0.0; extra == 'build'
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5.56; extra == 'docs'
Requires-Dist: mkdocs>=1.6.1; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.28.0; extra == 'docs'
Requires-Dist: pymdown-extensions>=10.14; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest-benchmark[histogram]>=4.0.0; extra == 'test'
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
Requires-Dist: pytest-xdist>=3.5.0; extra == 'test'
Requires-Dist: pytest>=7.0.0; extra == 'test'
Description-Content-Type: text/markdown

# twat-video

`twat-video` is the video domain plugin for the [`twat`](https://github.com/twardoch/twat) ecosystem. It provides reusable, testable ffmpeg command wrappers and a thin adapter layer for AI video generation via `twat_genai`.

## Requirements

- Python 3.10+
- `ffmpeg` and `ffprobe` on `PATH` for real media processing

Tests exercise command construction with `dry_run=True` and do not require media binaries.

## Installation

```bash
pip install twat-video
```

## Python API

```python
from twat_video import (
    crop_scale, change_fps, split_segment, reverse_video,
    merge_by_gap, import_audio, extract_subtitles, repair_srt_text,
    add_grain, add_reverb, ken_burns, probe_video, VideoClip,
)

# Crop and scale in one pass
crop_scale("input.mp4", "square.mp4", crop="1080:1080:420:0", scale="720:720")

# Extract a segment without re-encoding
split_segment("input.mp4", "clip.mp4", start=12.5, duration=4.0)

# Replace audio track
import_audio("silent.mp4", "voice.wav", "dubbed.mp4")
```

All functions accept `dry_run=True` — returns a `CommandResult` with the constructed command without invoking ffmpeg.

## CLI

```bash
python -m twat_video --help
python -m twat_video crop-scale in.mp4 out.mp4 --crop 1080:1080:420:0 --dry-run
python -m twat_video fps in.mp4 out.mp4 24 --dry-run
python -m twat_video split in.mp4 clip.mp4 --start 1.5 --duration 3 --dry-run
python -m twat_video import-audio silent.mp4 voice.wav dubbed.mp4 --dry-run
python -m twat_video ken-burns still.png out.mp4 --duration 5 --dry-run
python -m twat_video probe video.mp4
```

Available subcommands: `version`, `crop-scale`, `fps`, `split`, `reverse`, `import-audio`, `extract-subtitles`, `ken-burns`, `grain`, `reverb`, `concat`, `probe`, `genai`.

## AI video boundary

`generate_video()` imports `twat_genai` at runtime and delegates to its video generation API — no provider SDKs are bundled. Install `twat-genai` and configure a provider separately.

## twat plugin registration

Registered under the `video` key in the `twat.plugins` entry-point group.

## License

MIT
