# Codex Audio-Driven Video

Turn voice audio, SRT subtitles, and transcript text into a synchronized dynamic web video HTML.

The current version keeps one core capability from the old package: **audio-clock synchronization**. The visual system has been rebuilt around the local reference `动态视频网页素材.html`: 16:9 stage, black/bone/red/cyan/yellow palette, HUD timecode, canvas background motion, hard cuts, flash, grain, and data-driven high-impact shots.

```bash
npm run example
npm run validate
```

The generated demo is:

```text
examples/minimal/output/demo.html
```

## What It Standardizes

- `audio.currentTime` is the master clock.
- Subtitles, shot changes, progress, BGM fade, and canvas motion derive from that clock.
- Finished output is a single HTML file with inline CSS/JS and relative audio paths.
- The final page is clean for fullscreen recording: no visible audio controls or debug UI.

## Generate A Draft

```bash
node skills/audio-driven-video/scripts/create_project.js \
  --title "你的项目标题" \
  --audio "../input/voice.mp3" \
  --srt path/to/subtitle.srt \
  --text path/to/transcript.txt \
  --out path/to/output/video.html \
  --no-bgm
```

With BGM:

```bash
node skills/audio-driven-video/scripts/create_project.js \
  --title "你的项目标题" \
  --audio "../input/voice.mp3" \
  --srt path/to/subtitle.srt \
  --text path/to/transcript.txt \
  --out path/to/output/video.html \
  --bgm "../input/bgm.mp3"
```

## Polish With The Skill

```text
Use $audio-driven-video.
Voice audio: <path>
SRT: <path>
Transcript: <path>
Optional BGM: <path or none>

Create a single HTML video page. Keep audio.currentTime as the master clock. Use references/STYLE.md for the dynamic webpage video look.
```

## Validate

```bash
npm run validate
node skills/audio-driven-video/scripts/validate_html.js path/to/video.html
node skills/audio-driven-video/scripts/validate_skill.js skills/audio-driven-video
```

Validation checks the sync-critical parts: audio tag, no controls, no independent timers, cue timing, scene timing, scene function references, unreplaced placeholders, and absence of the removed old preset system.

## Structure

```text
skills/audio-driven-video/
├─ SKILL.md
├─ agents/openai.yaml
├─ assets/template.html
├─ references/STYLE.md
├─ references/PIPELINE.md
├─ references/CLAUDE_CODE_PROMPTS.md
└─ scripts/
   ├─ create_project.js
   ├─ create_demo_audio.js
   ├─ validate_html.js
   └─ validate_skill.js
```

## License

MIT
