@broberg/lens-daemon 0.1.9 → 0.1.11
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/package.json +2 -2
- package/src/frames.ts +5 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@broberg/lens-daemon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "The Lens module of the cardmem daemon (flows, critic, coverage, capture sessions, the /lens/* routes and the cardmem-lens MCP) as a package. The daemon mounts createLensRouter(deps) + createLensMcpRouter(deps). Bun runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"sharp": "^0.33.5",
|
|
16
16
|
"turndown": "^7.2.4",
|
|
17
17
|
"zod": "^3.23.8",
|
|
18
|
-
"@broberg/lens-engine": "0.
|
|
18
|
+
"@broberg/lens-engine": "0.13.0",
|
|
19
19
|
"@broberg/lens-svg": "0.1.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
package/src/frames.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
// moment the probe already named, because a 600-frame contact sheet is a disk bill
|
|
5
5
|
// and a token bill that answers nothing. The default is sparse-everywhere plus
|
|
6
6
|
// dense-where-it-matters.
|
|
7
|
-
|
|
7
|
+
// F007.14 — ffmpeg is run and probed through the engine's ONE implementation, the same
|
|
8
|
+
// one the fleet's video slicer (sliceVideo) uses; this file keeps only the fps cut.
|
|
9
|
+
import { ffmpegAvailable, runFfmpeg } from '@broberg/lens-engine';
|
|
8
10
|
import { mkdir, readdir, rm, stat } from 'node:fs/promises';
|
|
9
11
|
import { join } from 'node:path';
|
|
10
12
|
|
|
@@ -31,14 +33,7 @@ export interface CutResult {
|
|
|
31
33
|
unavailable?: string;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
export async function ffmpegAvailable(bin = 'ffmpeg'): Promise<boolean> {
|
|
36
|
-
return new Promise((resolve) => {
|
|
37
|
-
const p = spawn(bin, ['-version'], { stdio: 'ignore' });
|
|
38
|
-
p.on('error', () => resolve(false));
|
|
39
|
-
p.on('close', (code) => resolve(code === 0));
|
|
40
|
-
});
|
|
41
|
-
}
|
|
36
|
+
export { ffmpegAvailable };
|
|
42
37
|
|
|
43
38
|
/**
|
|
44
39
|
* Cut `video` into PNGs in `outDir`.
|
|
@@ -69,11 +64,7 @@ export async function cutFrames(
|
|
|
69
64
|
// flag was doing nothing even on the versions that still accepted it.
|
|
70
65
|
args.push('-vf', `fps=${fps}`, join(outDir, 'f-%05d.png'));
|
|
71
66
|
|
|
72
|
-
const code = await
|
|
73
|
-
const p = spawn(bin, args, { stdio: 'ignore' });
|
|
74
|
-
p.on('error', () => resolve(-1));
|
|
75
|
-
p.on('close', (c) => resolve(c ?? -1));
|
|
76
|
-
});
|
|
67
|
+
const code = await runFfmpeg(bin, args).then((r) => r.code, () => -1);
|
|
77
68
|
if (code !== 0) {
|
|
78
69
|
await rm(outDir, { recursive: true, force: true }).catch(() => {});
|
|
79
70
|
return { frames: [], unavailable: `ffmpeg exited ${code} — video kept, no stills` };
|