@lumy-pack/scene-sieve 0.2.0 → 0.2.1

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.
Files changed (29) hide show
  1. package/README.md +88 -25
  2. package/dist/cli/commands/Sieve.d.ts +5 -0
  3. package/dist/cli/options/parse-options.d.ts +5 -1
  4. package/dist/cli.mjs +749 -237
  5. package/dist/constants/package-version.d.ts +2 -0
  6. package/dist/constants/pipeline-defaults.d.ts +20 -0
  7. package/dist/core/index.d.ts +1 -0
  8. package/dist/core/orchestrator/orchestrator.d.ts +6 -0
  9. package/dist/core/utils/metadata/build-edge-metadata.d.ts +11 -0
  10. package/dist/core/utils/metadata/build-frame-metadata.d.ts +20 -0
  11. package/dist/core/utils/metadata/build-sieve-metadata.d.ts +14 -0
  12. package/dist/core/utils/metadata/build-tool-metadata.d.ts +8 -0
  13. package/dist/core/utils/metadata/change/build-frame-change.d.ts +20 -0
  14. package/dist/core/utils/metadata/change/select-regions.d.ts +8 -0
  15. package/dist/core/utils/metadata/change/union-area/y-coverage-tree.d.ts +26 -0
  16. package/dist/core/utils/metadata/change/union-area.d.ts +7 -0
  17. package/dist/core/utils/metadata/scale-bounding-box.d.ts +11 -0
  18. package/dist/core/utils/output/finalize-selection.d.ts +15 -0
  19. package/dist/core/utils/sheet/build-tile-label-svg.d.ts +8 -0
  20. package/dist/core/utils/sheet/format-tile-label.d.ts +7 -0
  21. package/dist/core/utils/sheet/render-contact-sheet.d.ts +19 -0
  22. package/dist/core/utils/sheet/sample-tile-frames.d.ts +10 -0
  23. package/dist/core/workspace/workspace.d.ts +11 -2
  24. package/dist/index.cjs +701 -205
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.mjs +700 -204
  27. package/dist/pipeline-worker.mjs +640 -188
  28. package/dist/types/index.d.ts +148 -0
  29. package/package.json +14 -11
@@ -10,6 +10,10 @@ export type SieveInput = {
10
10
  inputFrames: Buffer[];
11
11
  };
12
12
  export interface SieveOptionsBase {
13
+ /** Enable a contact sheet with defaults or selected overrides; disabled by default. */
14
+ sheet?: boolean | SheetOptions;
15
+ /** Include adjacent candidate edge diagnostics in the metadata document. */
16
+ includeEdges?: boolean;
13
17
  count?: number;
14
18
  threshold?: number;
15
19
  outputPath?: string;
@@ -27,6 +31,10 @@ export interface SieveOptionsBase {
27
31
  }
28
32
  export type SieveOptions = SieveOptionsBase & SieveInput;
29
33
  export interface ResolvedOptions {
34
+ /** Complete contact sheet settings, or null when disabled. */
35
+ sheet: Required<SheetOptions> | null;
36
+ /** Whether the document contains candidate edge diagnostics. */
37
+ includeEdges: boolean;
30
38
  mode: 'file' | 'buffer' | 'frames';
31
39
  inputPath?: string;
32
40
  count: number;
@@ -51,6 +59,12 @@ export interface SieveResult {
51
59
  outputBuffers?: Buffer[];
52
60
  animations?: AnimationMetadata[];
53
61
  video?: VideoMetadata;
62
+ /** Selected frames paired with output files or buffers; IDs are one-based. */
63
+ frames?: FrameMetadata[];
64
+ /** Layout of the rendered contact sheet; absent when no sheet exists. */
65
+ sheet?: SheetMetadata;
66
+ /** Encoded contact sheet for buffer and frames modes only. */
67
+ sheetBuffer?: Buffer;
54
68
  executionTimeMs: number;
55
69
  }
56
70
  export interface AnimationMetadata {
@@ -70,6 +84,15 @@ export interface VideoMetadata {
70
84
  width: number;
71
85
  height: number;
72
86
  };
87
+ /** Number of candidates before pruning. */
88
+ candidatesCount: number;
89
+ /** Number of selected frames after pruning. */
90
+ selectedCount: number;
91
+ /** Input mode and basename only; in-memory inputs have no file name. */
92
+ source: {
93
+ fileName: string | null;
94
+ mode: 'file' | 'buffer' | 'frames';
95
+ };
73
96
  }
74
97
  export interface FrameNode {
75
98
  id: number;
@@ -88,6 +111,131 @@ export interface ScoreEdge {
88
111
  * Maps directly to G(t) from the vision analysis pipeline.
89
112
  */
90
113
  score: number;
114
+ /** Analysis-space cluster partition; absent on failed pairs and synthetic edges. */
115
+ change?: EdgeChange;
116
+ }
117
+ /** Optional contact sheet overrides, validated before defaults are applied. */
118
+ export interface SheetOptions {
119
+ /** Maximum columns, an integer at least one; defaults to four. */
120
+ columns?: number;
121
+ /** Tile width in pixels, an integer at least sixteen; defaults to 320. */
122
+ tileWidth?: number;
123
+ /** Tile limit, an integer at least two; defaults to forty. */
124
+ maxTiles?: number;
125
+ /** Burn a frame ID and timestamp into each tile; defaults to true. */
126
+ label?: boolean;
127
+ }
128
+ /** Adjacent-pair cluster boxes in analysis coordinates, partitioned by the tracker. */
129
+ export interface EdgeChange {
130
+ /** Non-animation clusters in DBSCAN label order. */
131
+ regions: BoundingBox[];
132
+ /** Clusters whose indices the tracker classified as animation. */
133
+ animatedRegions: BoundingBox[];
134
+ }
135
+ /** Change across the candidate edges between two selected frames. */
136
+ export interface FrameChange {
137
+ /** Previous selected frame ID, one-based. */
138
+ fromFrameId: number;
139
+ /** Candidates pruned between the selected endpoints. */
140
+ skippedCandidates: number;
141
+ /** Maximum raw information gain, rounded to six decimals. */
142
+ peakScore: number;
143
+ /** Sum of raw information gain, rounded to six decimals. */
144
+ sumScore: number;
145
+ /** Non-animation union area fraction, clamped and rounded to four decimals. */
146
+ areaRatio: number;
147
+ /** Up to five distinct largest regions in clamped integer output pixels. */
148
+ regions: BoundingBox[];
149
+ }
150
+ /** Selected frame timing and change signals shared by file and API output. */
151
+ export interface FrameMetadata {
152
+ /** One-based position in the selected sequence. */
153
+ step: number;
154
+ /** Deterministic JPEG name, including for in-memory output pairing. */
155
+ fileName: string;
156
+ /** One-based candidate frame ID. */
157
+ frameId: number;
158
+ /** Rounded candidate timestamp in milliseconds. */
159
+ timestampMs: number;
160
+ /** Nonnegative time until the next selection or the source end. */
161
+ holdsMs: number;
162
+ /** Span summary, or null for the first selection. */
163
+ change: FrameChange | null;
164
+ }
165
+ /** Raw candidate edge diagnostics in graph order. */
166
+ export interface EdgeMetadata {
167
+ /** One-based source candidate ID. */
168
+ sourceFrameId: number;
169
+ /** One-based target candidate ID. */
170
+ targetFrameId: number;
171
+ /** Raw information gain rounded to six decimals. */
172
+ score: number;
173
+ /** Non-animation union area fraction rounded to four decimals. */
174
+ areaRatio: number;
175
+ /** Animation union area fraction rounded to four decimals. */
176
+ animatedAreaRatio: number;
177
+ }
178
+ /** Selection and encoding settings in deterministic serialization order. */
179
+ export interface ToolParams {
180
+ /** Requested extraction frequency, before the candidate cap. */
181
+ fps: number;
182
+ /** Requested maximum selected frame count. */
183
+ count: number;
184
+ /** Normalized pruning threshold. */
185
+ threshold: number;
186
+ /** Analysis image height in pixels. */
187
+ scale: number;
188
+ /** JPEG encoding quality. */
189
+ quality: number;
190
+ /** Strict file/buffer candidate cap. */
191
+ maxFrames: number;
192
+ /** Tracker overlap threshold. */
193
+ iouThreshold: number;
194
+ /** Consecutive frames required for animation classification. */
195
+ animationThreshold: number;
196
+ /** Maximum logical segment duration in seconds. */
197
+ maxSegmentDuration: number;
198
+ }
199
+ /** Tool provenance and reproducible pipeline parameters. */
200
+ export interface ToolMetadata {
201
+ /** Published package identifier. */
202
+ name: '@lumy-pack/scene-sieve';
203
+ /** Version from the runtime package manifest. */
204
+ version: string;
205
+ /** Nine selection and encoding parameters, excluding operational options. */
206
+ params: ToolParams;
207
+ }
208
+ /** Contact sheet layout and sampled frame IDs in tile order. */
209
+ export interface SheetMetadata {
210
+ /** Fixed output name. */
211
+ fileName: 'sheet.jpg';
212
+ /** Effective columns, capped by tile count. */
213
+ columns: number;
214
+ /** Tile width in pixels. */
215
+ tileWidth: number;
216
+ /** Aspect-preserving rounded tile height, at least one pixel. */
217
+ tileHeight: number;
218
+ /** One-based frame IDs ordered left-to-right, then top-to-bottom. */
219
+ frameIds: number[];
220
+ /** Whether the tile limit required uniform sampling. */
221
+ sampled: boolean;
222
+ }
223
+ /** Version-two document; properties are serialized in declaration order. */
224
+ export interface SieveMetadata {
225
+ /** Schema discriminator; absent in version-one documents. */
226
+ metadataVersion: 2;
227
+ /** Runtime tool provenance. */
228
+ tool: ToolMetadata;
229
+ /** Source timing, dimensions and candidate counts. */
230
+ video: VideoMetadata;
231
+ /** Selected frame summaries in temporal order. */
232
+ frames: FrameMetadata[];
233
+ /** Output-space animations with one-based IDs and integer durations. */
234
+ animations: AnimationMetadata[];
235
+ /** Present only when a sheet was rendered. */
236
+ sheet?: SheetMetadata;
237
+ /** Present only when includeEdges was enabled. */
238
+ edges?: EdgeMetadata[];
91
239
  }
92
240
  export interface BoundingBox {
93
241
  x: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumy-pack/scene-sieve",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI tool for extracting key frames from video and GIF files",
5
5
  "keywords": [
6
6
  "cli",
@@ -22,6 +22,9 @@
22
22
  },
23
23
  "sideEffects": false,
24
24
  "type": "module",
25
+ "engines": {
26
+ "node": "^20.19.0 || >=22.12.0"
27
+ },
25
28
  "exports": {
26
29
  ".": {
27
30
  "types": "./dist/index.d.ts",
@@ -54,23 +57,23 @@
54
57
  "version:patch": "yarn version patch"
55
58
  },
56
59
  "dependencies": {
57
- "@ffprobe-installer/ffprobe": "^1.4.1",
60
+ "@ffprobe-installer/ffprobe": "^2.1.2",
58
61
  "@techstark/opencv-js": "4.12.0-release.1",
59
- "@winglet/common-utils": "^0.12.2",
62
+ "@winglet/common-utils": "^0.14.1",
60
63
  "commander": "^12.1.0",
61
- "execa": "^9.5.0",
62
- "ffmpeg-static": "^5.2.0",
63
- "ink": "^5.0.0",
64
+ "execa": "^9.6.1",
65
+ "ffmpeg-static": "^5.3.0",
66
+ "ink": "^6.8.0",
64
67
  "ink-spinner": "^5.0.0",
65
68
  "picocolors": "^1.1.1",
66
- "react": "^18.0.0",
67
- "sharp": "^0.33.0"
69
+ "react": "^19.3.0",
70
+ "sharp": "^0.35.4"
68
71
  },
69
72
  "devDependencies": {
70
73
  "@lumy-pack/shared": "0.0.1",
71
- "@types/node": "^20.11.0",
72
- "@types/react": "^18.0.0",
74
+ "@types/node": "^20.19.43",
75
+ "@types/react": "^19.3.0",
73
76
  "@vitest/coverage-v8": "^3.2.4",
74
- "rolldown": "^1.2.0"
77
+ "rolldown": "^1.2.8"
75
78
  }
76
79
  }