@happyvertical/smrt-video 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +32 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +146 -0
- package/dist/index.d.ts +1277 -0
- package/dist/index.js +1898 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +16449 -0
- package/dist/smrt-knowledge.json +6258 -0
- package/package.json +74 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @happyvertical/smrt-video
|
|
2
|
+
|
|
3
|
+
AI video production pipeline: characters, performers, scenes, shots, sequences, compositions, and ComfyUI workflow integration.
|
|
4
|
+
|
|
5
|
+
## Models
|
|
6
|
+
|
|
7
|
+
- **Character** (renamed from PersonalityProfile): visual + voice identity. `imageAssetId`, `voiceProfileId` FK, branding config (logo, colors, fonts, lower-thirds). Scene-specific position/scale configs.
|
|
8
|
+
- **Performer**: physical likeness for IP-Adapter FaceID. `faceEmbedding` (512-dim), `referenceAssetIds`, `ipAdapterWeight`.
|
|
9
|
+
- **Scene**: virtual background. `sourceType` (image/video/panorama_360/panorama_180), `projection`, `viewpoints` array (pan/tilt/fov), `lightingProfile`, `anchorPoints`.
|
|
10
|
+
- **VideoShot** (extends Content): atomic generation unit. `durationInFrames`, `scriptText`, `scriptWordCount`. Estimated duration: `scriptWordCount / 2.7` words/sec (±15% tolerance). `videoMetadata` includes `wordTimings` for lip-sync.
|
|
11
|
+
- **VideoSequence** (extends Content): thematic section with `transitionType` (none/fade/slide/wipe), position ordering.
|
|
12
|
+
- **VideoComposition** (extends Content): top-level container — `fps`, `width`, `height`, `durationInFrames`, `renderStatus`/`renderProgress`.
|
|
13
|
+
- **VideoShotCharacter**: junction (shot ↔ character) with role (primary/secondary/background), position, duration.
|
|
14
|
+
- **VideoWorkflow**: ComfyUI template. `workflowJson`, `nodeMapping` (maps semantic names → node IDs), `workflowType` (prebake/broadcast/lipsync/postprod/custom). `injectParameters()` deep-clones workflow + overwrites `node.inputs`.
|
|
15
|
+
|
|
16
|
+
## Design Principles
|
|
17
|
+
|
|
18
|
+
- **Store frames, compute seconds**: `durationInFrames` everywhere; seconds = frames / fps
|
|
19
|
+
- **Content inheritance**: VideoShot, VideoSequence, VideoComposition all extend Content from smrt-content
|
|
20
|
+
- **Hierarchy**: Composition → Sequence → Shot → ShotCharacter
|
|
21
|
+
- **Owned asset normalization**: `CharacterOwnedAsset`, `PerformerOwnedAsset`, and `SceneOwnedAsset` are canonical noun joins; `VideoShot`/`VideoSequence`/`VideoComposition` use inherited `content_assets`
|
|
22
|
+
|
|
23
|
+
## Gotchas
|
|
24
|
+
|
|
25
|
+
- **PersonalityProfile → Character rename**: old name still exported for backwards compatibility
|
|
26
|
+
- **Legacy video STI asset rows**: reads still union canonical joins with legacy STI asset records during migration, but new writes go through the model helpers / join tables
|
|
27
|
+
- **Schema rollout**: run `smrt db:migrate` before relying on `character_assets` / `performer_assets` / `scene_assets` writes; reads still tolerate those tables being absent during migration
|
|
28
|
+
- **ComfyUI injectParameters()**: assumes `node.inputs` exists; warnings logged in dev mode
|
|
29
|
+
- **Frame arithmetic**: `trimBeforeFrames`/`trimAfterFrames` require manual effective frame calculation
|
|
30
|
+
- **Word timings from external TTS**: `wordTimings` array not generated by framework — requires external provider
|
|
31
|
+
- **IP-Adapter weights**: `faceEmbedding` upload not handled; weight is metadata-only (0.5-1.0)
|
|
32
|
+
- **Optional tenancy** on all core models
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright <2025> <Happy Vertical Corporation>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# @happyvertical/smrt-video
|
|
2
|
+
|
|
3
|
+
Video production pipeline for AI-powered video generation in the SMRT ecosystem. Models characters, performers, scenes, shots, sequences, compositions, and ComfyUI workflow templates.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @happyvertical/smrt-video
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
Character,
|
|
16
|
+
Performer,
|
|
17
|
+
Scene,
|
|
18
|
+
VideoShot,
|
|
19
|
+
VideoSequence,
|
|
20
|
+
VideoComposition,
|
|
21
|
+
VideoShotCharacter,
|
|
22
|
+
VideoWorkflow,
|
|
23
|
+
} from '@happyvertical/smrt-video';
|
|
24
|
+
import { Asset } from '@happyvertical/smrt-assets';
|
|
25
|
+
|
|
26
|
+
// Character = role being played (outfit, voice, branding)
|
|
27
|
+
const anchor = new Character({
|
|
28
|
+
name: 'Bentley News Anchor',
|
|
29
|
+
voiceProfileId: 'voice-123',
|
|
30
|
+
});
|
|
31
|
+
await anchor.save();
|
|
32
|
+
|
|
33
|
+
const seedImage = new Asset({
|
|
34
|
+
name: 'Anchor Seed',
|
|
35
|
+
sourceUri: 'file:///tmp/anchor-seed.png',
|
|
36
|
+
mimeType: 'image/png',
|
|
37
|
+
});
|
|
38
|
+
await seedImage.save();
|
|
39
|
+
await anchor.addAsset(seedImage, 'seed-image');
|
|
40
|
+
|
|
41
|
+
// Performer = physical likeness for IP-Adapter face consistency
|
|
42
|
+
const performer = new Performer({ name: 'Alex', ipAdapterWeight: 0.85 });
|
|
43
|
+
|
|
44
|
+
// Scene = virtual background (image, video, or 360 panorama)
|
|
45
|
+
const studio = new Scene({
|
|
46
|
+
name: 'News Studio',
|
|
47
|
+
sourceType: 'image',
|
|
48
|
+
projection: 'flat',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Hierarchy: Composition -> Sequence -> Shot -> ShotCharacter
|
|
52
|
+
const composition = new VideoComposition({
|
|
53
|
+
title: 'Evening News - March 2, 2026',
|
|
54
|
+
fps: 30,
|
|
55
|
+
width: 1920,
|
|
56
|
+
height: 1080,
|
|
57
|
+
});
|
|
58
|
+
await composition.save();
|
|
59
|
+
|
|
60
|
+
const shot = new VideoShot({
|
|
61
|
+
scriptText: 'Welcome to the evening news broadcast.',
|
|
62
|
+
targetDuration: 30,
|
|
63
|
+
});
|
|
64
|
+
await shot.save();
|
|
65
|
+
// Estimated speech duration: scriptWordCount / 2.7 words per second
|
|
66
|
+
shot.estimatedDuration; // ~2.2 seconds
|
|
67
|
+
await shot.addAsset(seedImage, 'thumbnail');
|
|
68
|
+
|
|
69
|
+
// ComfyUI workflow with dynamic parameter injection
|
|
70
|
+
const workflow = new VideoWorkflow({
|
|
71
|
+
name: 'Wan 2.6 + EchoMimic',
|
|
72
|
+
workflowType: 'broadcast',
|
|
73
|
+
workflowJson: comfyuiApiJson,
|
|
74
|
+
nodeMapping: { seedImage: '1', audioFile: '5', outputVideo: '12' },
|
|
75
|
+
requiredModels: ['wan_2.6_t2v_14b_fp8', 'echomimic_v2'],
|
|
76
|
+
});
|
|
77
|
+
await workflow.save();
|
|
78
|
+
|
|
79
|
+
// Inject runtime parameters into a deep-cloned workflow
|
|
80
|
+
const injected = workflow.injectParameters({
|
|
81
|
+
seedImage: '/path/to/anchor.png',
|
|
82
|
+
audioFile: '/path/to/tts.wav',
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
### Models
|
|
89
|
+
|
|
90
|
+
| Export | Description |
|
|
91
|
+
|--------|------------|
|
|
92
|
+
| `Character` | Virtual persona: seed image + voice profile + branding kit |
|
|
93
|
+
| `Performer` | Physical likeness for IP-Adapter FaceID consistency |
|
|
94
|
+
| `Scene` | Virtual background with viewpoints, lighting, and anchor points |
|
|
95
|
+
| `VideoShot` | Atomic generation unit (extends Content) with script and frame duration |
|
|
96
|
+
| `VideoShotCharacter` | Junction: shot-to-character with role (primary/secondary/background) |
|
|
97
|
+
| `VideoSequence` | Thematic section (extends Content) with transition type and ordering |
|
|
98
|
+
| `VideoComposition` | Top-level container (extends Content): fps, resolution, render status |
|
|
99
|
+
| `VideoWorkflow` | ComfyUI template with node mapping for parameter injection |
|
|
100
|
+
| `CompositeJob` | Tracks a multi-step video generation job |
|
|
101
|
+
|
|
102
|
+
Collections: `CharacterCollection`, `VideoCompositionCollection`, `VideoSequenceCollection`, `VideoShotCollection`, `VideoShotCharacterCollection`.
|
|
103
|
+
|
|
104
|
+
Canonical owned asset joins:
|
|
105
|
+
- `CharacterOwnedAsset` -> `character_assets`
|
|
106
|
+
- `PerformerOwnedAsset` -> `performer_assets`
|
|
107
|
+
- `SceneOwnedAsset` -> `scene_assets`
|
|
108
|
+
- `VideoShot`, `VideoSequence`, and `VideoComposition` inherit `Content` asset helpers backed by `content_assets`
|
|
109
|
+
|
|
110
|
+
Legacy STI asset subclasses `CharacterAsset`, `PerformerAsset`, `SceneAsset`, `VideoCompositionAsset`, `VideoSequenceAsset`, and `VideoShotAsset` remain readable during migration, but new writes should go through the model helpers.
|
|
111
|
+
Provision the new join tables with `smrt db:migrate` before relying on canonical writes. Reads still fall back to legacy fields / STI rows when the new tables are not present yet.
|
|
112
|
+
|
|
113
|
+
### Key Types
|
|
114
|
+
|
|
115
|
+
| Export | Description |
|
|
116
|
+
|--------|------------|
|
|
117
|
+
| `CharacterStatus` | `pending`, `ready` |
|
|
118
|
+
| `BrandingConfig` | Logo, colors, fonts, lower-thirds, ticker settings |
|
|
119
|
+
| `WorkflowType` | `prebake`, `broadcast`, `lipsync`, `postprod`, `custom` |
|
|
120
|
+
| `NodeMapping` | Maps semantic names (seedImage, audioFile, etc.) to ComfyUI node IDs |
|
|
121
|
+
| `RenderStatus` | `draft`, `rendering`, `ready`, `failed` |
|
|
122
|
+
| `VideoShotStatus` | `draft`, `queued`, `processing`, `ready`, `failed`, `published` |
|
|
123
|
+
| `TransitionType` | `none`, `fade`, `slide`, `wipe` |
|
|
124
|
+
| `VideoMetadata` | Duration, resolution, codec, fps, word timings |
|
|
125
|
+
| `SceneSourceType` | `image`, `video`, `panorama_360`, `panorama_180` |
|
|
126
|
+
| `VideoShotCharacterRole` | `primary`, `secondary`, `background` |
|
|
127
|
+
|
|
128
|
+
### Design Principle
|
|
129
|
+
|
|
130
|
+
Store frames, compute seconds. All duration fields use `durationInFrames`; convert with `frames / fps`. Speech duration estimated at 2.7 words/second (+/- 15% tolerance).
|
|
131
|
+
|
|
132
|
+
### Asset Ownership
|
|
133
|
+
|
|
134
|
+
`Character`, `Performer`, and `Scene` expose `getAssets()`, `getAssetByRole()`, `addAsset()`, and `removeAsset()` on canonical noun-join tables. They continue to read legacy scalar slots and legacy STI asset rows during migration.
|
|
135
|
+
|
|
136
|
+
`VideoShot`, `VideoSequence`, and `VideoComposition` inherit the same helpers from `Content`, so their canonical ownership table is `content_assets` rather than a video-specific join table.
|
|
137
|
+
|
|
138
|
+
## Dependencies
|
|
139
|
+
|
|
140
|
+
- `@happyvertical/smrt-core` -- ORM and code generation
|
|
141
|
+
- `@happyvertical/smrt-assets` -- base asset management
|
|
142
|
+
- `@happyvertical/smrt-config` -- configuration loading
|
|
143
|
+
- `@happyvertical/smrt-content` -- content models (VideoShot/Sequence/Composition extend Content)
|
|
144
|
+
- `@happyvertical/smrt-profiles` -- profile references for characters
|
|
145
|
+
- `@happyvertical/smrt-tenancy` -- multi-tenant scoping
|
|
146
|
+
- `@happyvertical/smrt-voice` -- voice profile references
|