@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.
Files changed (37) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/services/audioFxRender.d.ts +68 -0
  6. package/dist/services/audioFxRender.d.ts.map +1 -0
  7. package/dist/services/audioFxRender.js +360 -0
  8. package/dist/services/audioFxRender.js.map +1 -0
  9. package/dist/services/audioMixer.d.ts +15 -0
  10. package/dist/services/audioMixer.d.ts.map +1 -1
  11. package/dist/services/audioMixer.js +152 -14
  12. package/dist/services/audioMixer.js.map +1 -1
  13. package/dist/services/audioMixer.types.d.ts +10 -0
  14. package/dist/services/audioMixer.types.d.ts.map +1 -1
  15. package/dist/services/audioVolumeEnvelope.d.ts +11 -0
  16. package/dist/services/audioVolumeEnvelope.d.ts.map +1 -1
  17. package/dist/services/audioVolumeEnvelope.js +38 -25
  18. package/dist/services/audioVolumeEnvelope.js.map +1 -1
  19. package/dist/services/chunkEncoder.d.ts.map +1 -1
  20. package/dist/services/chunkEncoder.js +16 -12
  21. package/dist/services/chunkEncoder.js.map +1 -1
  22. package/dist/services/streamingEncoder.d.ts.map +1 -1
  23. package/dist/services/streamingEncoder.js +3 -0
  24. package/dist/services/streamingEncoder.js.map +1 -1
  25. package/dist/services/wavChunks.d.ts +29 -0
  26. package/dist/services/wavChunks.d.ts.map +1 -0
  27. package/dist/services/wavChunks.js +29 -0
  28. package/dist/services/wavChunks.js.map +1 -0
  29. package/dist/utils/ffprobe.d.ts +7 -0
  30. package/dist/utils/ffprobe.d.ts.map +1 -1
  31. package/dist/utils/ffprobe.js +1 -1
  32. package/dist/utils/ffprobe.js.map +1 -1
  33. package/dist/utils/renderProvenance.d.ts +50 -0
  34. package/dist/utils/renderProvenance.d.ts.map +1 -0
  35. package/dist/utils/renderProvenance.js +92 -0
  36. package/dist/utils/renderProvenance.js.map +1 -0
  37. 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","s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,WAAW;QACX,GAAG,sBAAsB,IAAI,kBAAkB,EAAE;KAClD,CAAC;IAEF,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACrC,2EAA2E;QAC3E,0EAA0E;QAC1E,uEAAuE;QACvE,yEAAyE;QACzE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,0BAA0B,CAAC,IAAc,EAAE,UAAkB;IAC3E,IAAI,CAAC,IAAI,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;AACjD,CAAC;AAQD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAoD;IAEpD,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;IAC1D,IAAI,QAAQ,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,EAAE,QAAQ,EAAE,OAAO,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.107",
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.107",
42
- "@hyperframes/parsers": "^0.7.107"
41
+ "@hyperframes/core": "^0.7.109",
42
+ "@hyperframes/parsers": "^0.7.109"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.0.10",