@hyperframes/engine 0.7.107 → 0.7.109
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/audioFxRender.d.ts +68 -0
- package/dist/services/audioFxRender.d.ts.map +1 -0
- package/dist/services/audioFxRender.js +360 -0
- package/dist/services/audioFxRender.js.map +1 -0
- package/dist/services/audioMixer.d.ts +15 -0
- package/dist/services/audioMixer.d.ts.map +1 -1
- package/dist/services/audioMixer.js +152 -14
- package/dist/services/audioMixer.js.map +1 -1
- package/dist/services/audioMixer.types.d.ts +10 -0
- package/dist/services/audioMixer.types.d.ts.map +1 -1
- package/dist/services/audioVolumeEnvelope.d.ts +11 -0
- package/dist/services/audioVolumeEnvelope.d.ts.map +1 -1
- package/dist/services/audioVolumeEnvelope.js +38 -25
- package/dist/services/audioVolumeEnvelope.js.map +1 -1
- package/dist/services/chunkEncoder.d.ts.map +1 -1
- package/dist/services/chunkEncoder.js +16 -12
- package/dist/services/chunkEncoder.js.map +1 -1
- package/dist/services/streamingEncoder.d.ts.map +1 -1
- package/dist/services/streamingEncoder.js +3 -0
- package/dist/services/streamingEncoder.js.map +1 -1
- package/dist/services/wavChunks.d.ts +29 -0
- package/dist/services/wavChunks.d.ts.map +1 -0
- package/dist/services/wavChunks.js +29 -0
- package/dist/services/wavChunks.js.map +1 -0
- package/dist/utils/ffprobe.d.ts +7 -0
- package/dist/utils/ffprobe.d.ts.map +1 -1
- package/dist/utils/ffprobe.js +1 -1
- package/dist/utils/ffprobe.js.map +1 -1
- package/dist/utils/renderProvenance.d.ts +50 -0
- package/dist/utils/renderProvenance.d.ts.map +1 -0
- package/dist/utils/renderProvenance.js +92 -0
- package/dist/utils/renderProvenance.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { readTagCI } from "./ffprobe.js";
|
|
3
|
+
/**
|
|
4
|
+
* Hidden render provenance.
|
|
5
|
+
*
|
|
6
|
+
* HyperFrames stamps the *container* — never the picture — with the renderer
|
|
7
|
+
* name and version, so a rendered file carries a machine-readable note about
|
|
8
|
+
* what produced it, with no visible watermark burned into the frames.
|
|
9
|
+
*
|
|
10
|
+
* What goes in is deliberately boring: renderer name and version. No file
|
|
11
|
+
* paths, usernames, machine names, project names or composition content. Once
|
|
12
|
+
* a file is distributed the metadata travels with it, and metadata leaks are
|
|
13
|
+
* hard to walk back.
|
|
14
|
+
*
|
|
15
|
+
* **An unauthenticated hint — not an authenticity or attribution boundary.**
|
|
16
|
+
* These are ordinary unsigned container keys that any tool can write, so a
|
|
17
|
+
* present tag means the file *claims* to be HyperFrames output, not that
|
|
18
|
+
* HyperFrames produced it: one `ffmpeg -metadata hyperframes_renderer=...`
|
|
19
|
+
* forges it. Absence proves just as little, since re-encoding, remuxing, or
|
|
20
|
+
* any tool that drops unknown keys strips them, and files rendered before this
|
|
21
|
+
* feature never had them. Good for diagnostics and support ("what wrote this
|
|
22
|
+
* file?"); never a basis for trust, attribution or licensing decisions in
|
|
23
|
+
* either direction. Verifiable provenance needs signed claims (C2PA), which
|
|
24
|
+
* this deliberately is not.
|
|
25
|
+
*/
|
|
26
|
+
export const PROVENANCE_RENDERER_TAG = "hyperframes_renderer";
|
|
27
|
+
export const PROVENANCE_VERSION_TAG = "hyperframes_version";
|
|
28
|
+
export const PROVENANCE_RENDERER_NAME = "hyperframes";
|
|
29
|
+
const UNKNOWN_VERSION = "0.0.0-dev";
|
|
30
|
+
function readEngineVersion() {
|
|
31
|
+
try {
|
|
32
|
+
// The engine ships as raw TS and exports "./package.json", so this
|
|
33
|
+
// resolves without a build-time define. A failed read must never break a
|
|
34
|
+
// render, hence the fallback rather than a throw.
|
|
35
|
+
const version = createRequire(import.meta.url)("../../package.json")
|
|
36
|
+
.version;
|
|
37
|
+
return typeof version === "string" && version.length > 0 ? version : UNKNOWN_VERSION;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return UNKNOWN_VERSION;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export const PROVENANCE_VERSION = readEngineVersion();
|
|
44
|
+
/**
|
|
45
|
+
* MP4/MOV (the mov muxer family) writes only tags it recognises from a fixed
|
|
46
|
+
* map and silently discards everything else. WebM/Matroska keeps arbitrary
|
|
47
|
+
* keys as-is.
|
|
48
|
+
*/
|
|
49
|
+
function isMovFamilyContainer(outputPath) {
|
|
50
|
+
const lower = outputPath.toLowerCase();
|
|
51
|
+
return lower.endsWith(".mp4") || lower.endsWith(".mov") || lower.endsWith(".m4v");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The provenance ffmpeg arguments for a given output container. Place them
|
|
55
|
+
* before the output path.
|
|
56
|
+
*
|
|
57
|
+
* Must be applied on *every* stage that writes an mp4 — encode, mux and the
|
|
58
|
+
* faststart remux each run their own ffmpeg, and a stage without the flag
|
|
59
|
+
* drops the tags written by the stage before it.
|
|
60
|
+
*/
|
|
61
|
+
export function renderProvenanceArgs(outputPath) {
|
|
62
|
+
const args = [
|
|
63
|
+
"-metadata",
|
|
64
|
+
`${PROVENANCE_RENDERER_TAG}=${PROVENANCE_RENDERER_NAME}`,
|
|
65
|
+
"-metadata",
|
|
66
|
+
`${PROVENANCE_VERSION_TAG}=${PROVENANCE_VERSION}`,
|
|
67
|
+
];
|
|
68
|
+
if (isMovFamilyContainer(outputPath)) {
|
|
69
|
+
// The additive `+` form is mandatory. A bare `-movflags use_metadata_tags`
|
|
70
|
+
// *resets* the flag field, silently discarding a `+faststart` set earlier
|
|
71
|
+
// in the same command — the file still probes fine and keeps its tags,
|
|
72
|
+
// but the moov atom lands at the end and progressive playback regresses.
|
|
73
|
+
args.push("-movflags", "+use_metadata_tags");
|
|
74
|
+
}
|
|
75
|
+
return args;
|
|
76
|
+
}
|
|
77
|
+
/** Mutating form of {@link renderProvenanceArgs} for push-built arg lists. */
|
|
78
|
+
export function appendRenderProvenanceArgs(args, outputPath) {
|
|
79
|
+
args.push(...renderProvenanceArgs(outputPath));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Read provenance back from ffprobe format tags. Matroska uppercases keys on
|
|
83
|
+
* read while mp4 preserves the case written, so the lookup is
|
|
84
|
+
* case-insensitive — a case-sensitive read works on mp4 and misses every webm.
|
|
85
|
+
*/
|
|
86
|
+
export function readRenderProvenance(tags) {
|
|
87
|
+
const renderer = readTagCI(tags, PROVENANCE_RENDERER_TAG);
|
|
88
|
+
if (renderer === "")
|
|
89
|
+
return null;
|
|
90
|
+
return { renderer, version: readTagCI(tags, PROVENANCE_VERSION_TAG) };
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=renderProvenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderProvenance.js","sourceRoot":"","sources":["../../src/utils/renderProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAC9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAEtD,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,mEAAmE;QACnE,yEAAyE;QACzE,kDAAkD;QAClD,MAAM,OAAO,GAAI,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAA0B;aAC3F,OAAO,CAAC;QACX,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAA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AAO,EAAE,SAAS,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC;AACxE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/engine",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.109",
|
|
4
4
|
"description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"linkedom": "^0.18.12",
|
|
39
39
|
"puppeteer": "^25.2.1",
|
|
40
40
|
"puppeteer-core": "^25.2.1",
|
|
41
|
-
"@hyperframes/core": "^0.7.
|
|
42
|
-
"@hyperframes/parsers": "^0.7.
|
|
41
|
+
"@hyperframes/core": "^0.7.109",
|
|
42
|
+
"@hyperframes/parsers": "^0.7.109"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.10",
|