oscilloscope-video-gen/README.md
2026-01-18 15:34:01 +01:00

139 lines
2.9 KiB
Markdown

# Oscilloscope Video Generator
A high-performance Rust tool for generating oscilloscope-style visualizations from audio files. Uses parallel rendering for fast processing.
## Features
- **Multiple visualization modes**: combined, separate, all (L/R + XY)
- **Parallel rendering**: Uses all CPU cores for fast frame generation
- **High quality output**: Supports up to 4K resolution at 60fps
- **Original audio**: Copies audio stream without re-encoding (perfect sync)
- **Customizable**: Colors, resolution, FPS, line thickness
## Installation
### From Source
```bash
cd oscilloscope-video-gen
cargo install --path .
```
### Build Only
```bash
cargo build --release
```
The binary will be at `target/release/oscilloscope-video-gen`.
## Usage
### Basic
```bash
oscilloscope-video-gen -i audio.wav -o video.mp4
```
### Full Options
```bash
oscilloscope-video-gen \
-i audio.wav \
-o video.mp4 \
--width 1920 \
--height 1080 \
--fps 30 \
--mode all \
--quality high \
--left-color "#00ff00" \
--right-color "#00ccff" \
--xy-color "#ff8800" \
--background "#0a0f0a" \
--line-thickness 2 \
--threads 8 \
--overwrite \
--verbose
```
### Options
| Option | Default | Description |
|--------|---------|-------------|
| `-i, --input` | Required | Input WAV file |
| `-o, --output` | Auto-generated | Output MP4 file |
| `--width` | 1920 | Video width in pixels |
| `--height` | 1080 | Video height in pixels |
| `--fps` | 30 | Frames per second |
| `--mode` | all | Visualization mode |
| `--quality` | high | Video quality |
| `--left-color` | #00ff00 | Left channel color (hex) |
| `--right-color` | #00ccff | Right channel color (hex) |
| `--xy-color` | #ff8800 | XY mode color (hex) |
| `--background` | #0a0f0a | Background color (hex) |
| `--show-grid` | true | Show grid lines |
| `--line-thickness` | 2 | Line thickness in pixels |
| `--threads` | All cores | Number of rendering threads |
| `--overwrite` | false | Overwrite output file |
| `--verbose` | false | Enable verbose output |
### Modes
- `combined`: Both channels merged into single waveform
- `separate`: Left on top, Right on bottom
- `all`: Left and Right on top row, XY pattern on bottom
### Quality Presets
| Preset | Video Bitrate |
|--------|---------------|
| low | 2 Mbps |
| medium | 5 Mbps |
| high | 10 Mbps |
## Requirements
- Rust 1.70+
- ffmpeg (for video encoding)
## Building
```bash
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Build with specific number of threads
cargo build --release --jobs 8
```
## Troubleshooting
### ffmpeg not found
Make sure ffmpeg is installed and in your PATH:
```bash
# Ubuntu/Debian
sudo apt install ffmpeg
# macOS
brew install ffmpeg
# Windows
winget install FFmpeg
```
### Out of memory
For very long audio files, try:
- Lower resolution (`--width 1280 --height 720`)
- Lower FPS (`--fps 24`)
- Fewer threads (`--threads 4`)
## License
MIT