> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Module

> AI-powered video editing with automatic filler removal, repetition detection, and smart editing

# Video Module

The `praisonai.video` module provides end-to-end AI-powered video editing capabilities. It automatically:

* **Transcribes** audio with word-level timestamps
* **Removes filler words** (um, uh, like, you know)
* **Detects and removes repetitions** (stutters, restarts)
* **Identifies tangent segments** (off-topic content)
* **Removes long silences**
* **Generates captions** (SRT format or burned-in)
* **Produces edit decision lists** (EDL)

## Requirements

* **FFmpeg**: Required for video processing
  ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
  # macOS
  brew install ffmpeg

  # Linux
  apt install ffmpeg
  ```

* **OpenAI API Key**: Required for transcription and content analysis
  ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
  export OPENAI_API_KEY="your-key-here"
  ```

## Quick Start

### Python API

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import video

# Simple edit with preset
result = video.edit(
    input_path="input.mp4",
    preset="podcast",
    output_path="out.mp4"
)

print(f"Output: {result.output_path}")
print(f"Original: {result.original_duration:.1f}s")
print(f"Final: {result.final_duration:.1f}s")
print(f"Saved: {result.time_saved:.1f}s")
```

### CLI

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Basic podcast editing
praisonai video edit input.mp4 --preset podcast --output out.mp4

# With custom options
praisonai video edit input.mp4 \
  --remove-fillers \
  --remove-repetitions \
  --target-length 10m \
  --verbose
```

## API Reference

### `video.edit()`

Main function for AI-powered video editing.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result = video.edit(
    input_path: str,
    output_path: str = None,
    preset: str = "podcast",
    workdir: str = None,
    remove_fillers: bool = None,
    remove_repetitions: bool = None,
    remove_tangents: bool = None,
    remove_silence: bool = None,
    auto_crop: str = "off",
    target_length: str = None,
    captions: str = "srt",
    provider: str = "auto",
    use_llm: bool = True,
    force: bool = False,
    verbose: bool = False
)
```

**Parameters:**

| Parameter            | Type | Default   | Description                                   |
| -------------------- | ---- | --------- | --------------------------------------------- |
| `input_path`         | str  | required  | Path to input video file                      |
| `output_path`        | str  | None      | Output path (default: input\_edited.mp4)      |
| `preset`             | str  | "podcast" | Edit preset (podcast, meeting, course, clean) |
| `workdir`            | str  | None      | Working directory for temp files              |
| `remove_fillers`     | bool | None      | Remove filler words (overrides preset)        |
| `remove_repetitions` | bool | None      | Remove repeated phrases                       |
| `remove_tangents`    | bool | None      | Remove off-topic content                      |
| `remove_silence`     | bool | None      | Remove long silences                          |
| `auto_crop`          | str  | "off"     | Crop mode (off, center, face)                 |
| `target_length`      | str  | None      | Target duration (e.g., "6m", "90s")           |
| `captions`           | str  | "srt"     | Caption mode (off, srt, burn)                 |
| `provider`           | str  | "auto"    | Transcription provider (openai, local, auto)  |
| `use_llm`            | bool | True      | Use LLM for content analysis                  |
| `force`              | bool | False     | Overwrite output if exists                    |
| `verbose`            | bool | False     | Print progress messages                       |

**Returns:** `VideoEditResult` object

### `video.probe()`

Extract video metadata.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result = video.probe(input_path: str)
```

**Returns:** `VideoProbeResult` with:

* `duration`: Video duration in seconds
* `width`, `height`: Resolution
* `fps`: Frame rate
* `codec`: Video codec
* `audio_codec`: Audio codec
* `file_size`: File size in bytes

### `video.transcript()`

Generate transcript with word-level timestamps.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result = video.transcript(
    input_path: str,
    provider: str = "auto",
    language: str = "en"
)
```

**Returns:** `TranscriptResult` with:

* `text`: Full transcript text
* `words`: List of words with timestamps
* `duration`: Audio duration
* `provider`: Provider used

## Presets

| Preset    | Fillers | Repetitions | Tangents | Silence Threshold |
| --------- | ------- | ----------- | -------- | ----------------- |
| `podcast` | ✓       | ✓           | ✗        | 700ms             |
| `meeting` | ✓       | ✓           | ✓        | 1000ms            |
| `course`  | ✓       | ✓           | ✗        | 500ms             |
| `clean`   | ✓       | ✓           | ✓        | 600ms             |

## Output Files

After editing, you'll find:

| File                     | Description                |
| ------------------------ | -------------------------- |
| `*_edited.mp4`           | Final edited video         |
| `transcript.txt`         | Plain text transcript      |
| `captions.srt`           | SRT caption file           |
| `edit_plan.json`         | Detailed edit plan         |
| `edit_decision_list.edl` | Professional EDL           |
| `report.json`            | Complete processing report |

## Result Objects

### VideoEditResult

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result.output_path      # Path to edited video
result.report_path      # Path to JSON report
result.transcript_path  # Path to transcript
result.srt_path         # Path to SRT captions
result.edl_path         # Path to EDL file
result.original_duration  # Original duration (seconds)
result.final_duration   # Final duration (seconds)
result.time_saved       # Time removed (seconds)
result.compression_ratio  # final/original ratio
result.edit_plan        # EditPlan object
```

### EditPlan

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
plan.segments_to_keep    # List of kept segments
plan.segments_to_remove  # List of removed segments
plan.chapters           # Chapter markers
plan.summary            # Content summary
plan.topics             # Detected topics
plan.total_keep_duration
plan.total_remove_duration
plan.removal_stats      # Dict of duration by category
```

## Examples

### Custom Filler Removal

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import video

result = video.edit(
    input_path="podcast.mp4",
    remove_fillers=True,
    remove_repetitions=True,
    remove_silence=True,
    
)

# Check what was removed
for category, duration in result.edit_plan.removal_stats.items():
    print(f"{category}: {duration:.1f}s removed")
```

### Meeting with Target Length

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result = video.edit(
    input_path="meeting.mp4",
    preset="meeting",
    remove_tangents=True,
    target_length="30m",
    output_path="meeting_summary.mp4"
)
```

### Generate Transcript Only

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import video

transcript = video.transcript("lecture.mp4")
print(transcript.text)

# Save as SRT
transcript.to_srt("lecture.srt")
```

### Probe Video Metadata

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import video

info = video.probe("video.mp4")
print(f"Duration: {info.duration}s")
print(f"Resolution: {info.width}x{info.height}")
print(f"FPS: {info.fps}")
```

## CLI Reference

### `praisonai video edit`

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai video edit <input> [options]

Options:
  --output, -o PATH       Output video path
  --preset PRESET         Edit preset (podcast, meeting, course, clean)
  --remove-fillers        Remove filler words
  --remove-repetitions    Remove repeated phrases
  --remove-tangents       Remove off-topic content
  --auto-crop MODE        Crop mode (off, center, face)
  --target-length TIME    Target duration (e.g., 6m, 90s)
  --captions MODE         Caption mode (off, srt, burn)
  --provider PROVIDER     Transcription provider (openai, local, auto)
  --no-llm                Use simple pattern matching
  --force                 Overwrite output if exists
  --json-report PATH      Save JSON report
  --verbose, -v           Enable verbose output
```

### `praisonai video probe`

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai video probe <input> [--json]
```

### `praisonai video transcript`

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai video transcript <input> [options]

Options:
  --output, -o PATH       Output file path
  --format FORMAT         Output format (srt, txt, json)
  --provider PROVIDER     Transcription provider
  --language LANG         Language code (default: en)
```

## Installation

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Basic video support
pip install "praisonai[video]"

# With local transcription (faster-whisper)
pip install "praisonai[video-local]"
```
