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

# Process Video

> Process local video files to extract frames and generate analysis

# Video Processing

The `process-video` command handles local video files, extracting frames and preparing them for analysis. It includes intelligent file size management and compression features.

## Prerequisites

* FFmpeg installed on your system (required for video processing)
* Sufficient disk space for temporary files
* Supported video format (mp4, avi, mov, etc.)

## Usage

```bash theme={null}
transfer-learning process-video <video_path> [options]
```

## File Size Management

The tool automatically handles large video files:

1. **Size Check**: Verifies if the video size exceeds configured limits
2. **Compression**: If needed, compresses the video while preserving quality
   * Uses FFmpeg with H.264 codec
   * Intelligent bitrate calculation
   * Progress tracking during compression
   * Quality preservation algorithms
3. **Temporary Files**: Manages compressed versions in system temp directory
4. **Cleanup**: Automatically removes temporary files after processing

## Options

| Option             | Description                         | Default    |
| ------------------ | ----------------------------------- | ---------- |
| `--output-dir`     | Directory to save processed files   | `./output` |
| `--batch-size`     | Number of frames to process at once | 30         |
| `--max-size`       | Maximum video size in MB            | 500        |
| `--frame-interval` | Frames to skip between extractions  | 30         |

## Examples

Basic usage:

```bash theme={null}
transfer-learning process-video path/to/video.mp4
```

With custom options:

```bash theme={null}
transfer-learning process-video path/to/video.mp4 \
  --output-dir ./my_output \
  --batch-size 50 \
  --max-size 1000 \
  --frame-interval 60
```

## Output Format

The command creates the following directory structure:

```
output/
├── frames/          # Extracted video frames
├── metadata.json    # Video metadata including compression info
└── processing_log.txt   # Detailed processing log
```

## Metadata Format

```json theme={null}
{
  "video_info": {
    "original_size": "1200MB",
    "compressed_size": "480MB",
    "compression_ratio": 2.5,
    "codec_used": "libx264",
    "duration": "10:30",
    "resolution": "1920x1080",
    "fps": 30
  },
  "processing": {
    "frames_extracted": 150,
    "frame_interval": 30,
    "compression_applied": true,
    "processing_time": "5:30"
  }
}
```

## Error Handling

The command includes robust error handling:

* Validates video format before processing
* Checks FFmpeg availability
* Monitors compression progress
* Provides detailed error messages
* Implements fallback options for compression

## Best Practices

1. Ensure sufficient disk space (2-3x video size)
2. Use recommended video formats (MP4 with H.264)
3. Monitor the processing log for details
4. Keep FFmpeg updated for best performance

## Next Steps

After processing a video, you can:

1. [Generate a guide](/cli/generate-guide) from the processed data
2. [Transcribe the audio](/cli/transcribe) from the video
3. [Analyze the content](/cli/analyze) in more detail

## Related Commands

* [Generate Guide](/cli/generate-guide)
* [Process YouTube](/cli/process-youtube)
* [YouTube Guide](/cli/youtube-guide)
