@thinkable-labs/lower-third-generator 1.0.0 → 1.0.2

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 (36) hide show
  1. package/dist/prebundle.d.ts +2 -0
  2. package/dist/prebundle.js +28 -0
  3. package/dist/renderer.d.ts +4 -0
  4. package/dist/renderer.js +39 -7
  5. package/package.json +5 -3
  6. package/remotion-bundle/108.bundle.js +11 -0
  7. package/remotion-bundle/108.bundle.js.map +1 -0
  8. package/remotion-bundle/242.bundle.js +11 -0
  9. package/remotion-bundle/242.bundle.js.map +1 -0
  10. package/remotion-bundle/243.bundle.js +3479 -0
  11. package/remotion-bundle/243.bundle.js.map +1 -0
  12. package/remotion-bundle/28.bundle.js +64 -0
  13. package/remotion-bundle/28.bundle.js.map +1 -0
  14. package/remotion-bundle/29.bundle.js +11 -0
  15. package/remotion-bundle/29.bundle.js.map +1 -0
  16. package/remotion-bundle/32.bundle.js +4462 -0
  17. package/remotion-bundle/32.bundle.js.map +1 -0
  18. package/remotion-bundle/423.bundle.js +11 -0
  19. package/remotion-bundle/423.bundle.js.map +1 -0
  20. package/remotion-bundle/587.bundle.js +205 -0
  21. package/remotion-bundle/587.bundle.js.map +1 -0
  22. package/remotion-bundle/598.bundle.js +115844 -0
  23. package/remotion-bundle/598.bundle.js.map +1 -0
  24. package/remotion-bundle/610.bundle.js +14678 -0
  25. package/remotion-bundle/610.bundle.js.map +1 -0
  26. package/remotion-bundle/803.bundle.js +451 -0
  27. package/remotion-bundle/803.bundle.js.map +1 -0
  28. package/remotion-bundle/924.bundle.js +21 -0
  29. package/remotion-bundle/924.bundle.js.map +1 -0
  30. package/remotion-bundle/bundle.js +11179 -0
  31. package/remotion-bundle/bundle.js.map +1 -0
  32. package/remotion-bundle/favicon.ico +0 -0
  33. package/remotion-bundle/index.html +49 -0
  34. package/remotion-bundle/public/WoodBlockCG.otf +0 -0
  35. package/remotion-bundle/public/logo.png +0 -0
  36. package/remotion-bundle/source-map-helper.wasm +0 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prebundle.d.ts.map
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const bundler_1 = require("@remotion/bundler");
7
+ const path_1 = __importDefault(require("path"));
8
+ async function prebundle() {
9
+ const entry = path_1.default.resolve(__dirname, "..", "remotion", "index.ts");
10
+ const outDir = path_1.default.resolve(__dirname, "..", "remotion-bundle");
11
+ console.log("Pre-bundling Remotion composition...");
12
+ console.log("Entry:", entry);
13
+ console.log("Output:", outDir);
14
+ await (0, bundler_1.bundle)({
15
+ entryPoint: entry,
16
+ outDir,
17
+ publicDir: path_1.default.resolve(__dirname, "..", "public"),
18
+ enableCaching: true,
19
+ });
20
+ console.log("Bundle saved to:", outDir);
21
+ }
22
+ if (require.main === module) {
23
+ prebundle().catch((err) => {
24
+ console.error("Prebundle failed:", err);
25
+ process.exit(1);
26
+ });
27
+ }
28
+ //# sourceMappingURL=prebundle.js.map
@@ -6,6 +6,8 @@ export interface RenderOptions {
6
6
  durationInFrames?: number;
7
7
  width?: number;
8
8
  height?: number;
9
+ serveUrl?: string;
10
+ binariesDirectory?: string;
9
11
  }
10
12
  export interface RenderResult {
11
13
  text: string;
@@ -19,6 +21,8 @@ export interface BatchOptions {
19
21
  durationInFrames?: number;
20
22
  width?: number;
21
23
  height?: number;
24
+ serveUrl?: string;
25
+ binariesDirectory?: string;
22
26
  }
23
27
  export interface BatchResult {
24
28
  results: RenderResult[];
package/dist/renderer.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.renderLowerThird = renderLowerThird;
7
7
  exports.renderBatch = renderBatch;
8
8
  const path_1 = __importDefault(require("path"));
9
+ const fs_1 = __importDefault(require("fs"));
9
10
  const bundler_1 = require("@remotion/bundler");
10
11
  const renderer_1 = require("@remotion/renderer");
11
12
  // ─── Sanitize filename ──────────────────────────────────────────────────────
@@ -15,15 +16,38 @@ function sanitizeFileName(text) {
15
16
  .replace(/\s+/g, "_")
16
17
  .substring(0, 60);
17
18
  }
18
- // ─── Bundle cache ───────────────────────────────────────────────────────────
19
+ // ─── Serve URL resolution ───────────────────────────────────────────────────
20
+ // Check for pre-built bundle shipped with the package
21
+ function getDefaultBundlePath() {
22
+ const bundlePath = path_1.default.resolve(__dirname, "..", "remotion-bundle");
23
+ if (fs_1.default.existsSync(bundlePath)) {
24
+ return bundlePath;
25
+ }
26
+ return null;
27
+ }
28
+ // Fallback: runtime bundling (works in dev, fails in ASAR)
19
29
  let bundlePromise = null;
20
30
  async function getBundled() {
21
31
  if (!bundlePromise) {
22
32
  const remotionEntry = path_1.default.resolve(__dirname, "..", "remotion", "index.ts");
23
- bundlePromise = (0, bundler_1.bundle)({ entryPoint: remotionEntry });
33
+ bundlePromise = (0, bundler_1.bundle)({
34
+ entryPoint: remotionEntry,
35
+ publicDir: path_1.default.resolve(__dirname, "..", "public"),
36
+ });
24
37
  }
25
38
  return bundlePromise;
26
39
  }
40
+ async function resolveServeUrl(serveUrl) {
41
+ // 1. Explicit serveUrl passed by caller (e.g., Electron app with ASAR-fixed path)
42
+ if (serveUrl)
43
+ return serveUrl;
44
+ // 2. Pre-built bundle shipped with the package
45
+ const defaultBundle = getDefaultBundlePath();
46
+ if (defaultBundle)
47
+ return defaultBundle;
48
+ // 3. Fallback: runtime bundling (dev mode only)
49
+ return getBundled();
50
+ }
27
51
  // ─── Render a single lower third ────────────────────────────────────────────
28
52
  async function renderLowerThird(options) {
29
53
  const fps = options.fps ?? 60;
@@ -32,11 +56,12 @@ async function renderLowerThird(options) {
32
56
  const height = options.height ?? 2160;
33
57
  const fileName = options.fileName ?? `${sanitizeFileName(options.text)}.mov`;
34
58
  const outputPath = path_1.default.join(options.outputDir, fileName);
35
- const bundled = await getBundled();
59
+ const serveUrl = await resolveServeUrl(options.serveUrl);
36
60
  const composition = await (0, renderer_1.selectComposition)({
37
- serveUrl: bundled,
61
+ serveUrl,
38
62
  id: "LowerThird",
39
63
  inputProps: { text: options.text },
64
+ ...(options.binariesDirectory ? { binariesDirectory: options.binariesDirectory } : {}),
40
65
  });
41
66
  // Override composition settings
42
67
  composition.fps = fps;
@@ -45,13 +70,15 @@ async function renderLowerThird(options) {
45
70
  composition.height = height;
46
71
  await (0, renderer_1.renderMedia)({
47
72
  composition,
48
- serveUrl: bundled,
73
+ serveUrl,
49
74
  codec: "prores",
50
75
  proResProfile: "4444",
51
76
  pixelFormat: "yuva444p10le",
52
77
  imageFormat: "png",
53
78
  outputLocation: outputPath,
54
79
  inputProps: { text: options.text },
80
+ muted: true,
81
+ ...(options.binariesDirectory ? { binariesDirectory: options.binariesDirectory } : {}),
55
82
  });
56
83
  return {
57
84
  text: options.text,
@@ -64,8 +91,11 @@ async function renderBatch(options, onProgress) {
64
91
  const results = [];
65
92
  const errors = [];
66
93
  let successCount = 0;
67
- // Pre-bundle once for all renders
68
- await getBundled();
94
+ // Resolve bundle once for all renders
95
+ const serveUrl = await resolveServeUrl(options.serveUrl);
96
+ if (!fs_1.default.existsSync(options.outputDir)) {
97
+ fs_1.default.mkdirSync(options.outputDir, { recursive: true });
98
+ }
69
99
  for (let i = 0; i < options.texts.length; i++) {
70
100
  const text = options.texts[i];
71
101
  onProgress?.({
@@ -82,6 +112,8 @@ async function renderBatch(options, onProgress) {
82
112
  durationInFrames: options.durationInFrames,
83
113
  width: options.width,
84
114
  height: options.height,
115
+ serveUrl,
116
+ binariesDirectory: options.binariesDirectory,
85
117
  });
86
118
  results.push(result);
87
119
  successCount++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkable-labs/lower-third-generator",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Generate lower third videos with alpha channel using Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,14 +8,16 @@
8
8
  "dist/**/*.js",
9
9
  "dist/**/*.d.ts",
10
10
  "remotion/**/*",
11
+ "remotion-bundle/**/*",
11
12
  "public/**/*",
12
13
  "assets/**/*"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsc",
16
- "prepublishOnly": "tsc",
17
+ "prebundle": "node dist/prebundle.js",
18
+ "prepublishOnly": "npm run build && npm run prebundle",
17
19
  "preview": "remotion preview remotion/index.ts",
18
- "test-render": "remotion render remotion/index.ts LowerThird --output test-output.mov --codec prores --prores-profile 4444 --scale 2"
20
+ "test-render": "remotion render remotion/index.ts LowerThird --output test-output.mov --codec prores --prores-profile 4444 --pixel-format yuva444p10le --image-format png"
19
21
  },
20
22
  "license": "UNLICENSED",
21
23
  "dependencies": {
@@ -0,0 +1,11 @@
1
+ (self["webpackChunk_thinkable_labs_lower_third_generator"] = self["webpackChunk_thinkable_labs_lower_third_generator"] || []).push([[108],{
2
+
3
+ /***/ 6108
4
+ () {
5
+
6
+ /* (ignored) */
7
+
8
+ /***/ }
9
+
10
+ }]);
11
+ //# sourceMappingURL=108.bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"108.bundle.js","mappings":";;;;;AAAA","sources":["ignored|/Users/lee.marreros/Documents/Freelance/audio-qc-tool/node_modules/@mediabunny/aac-encoder/dist/bundles|worker_threads"],"sourcesContent":["/* (ignored) */"],"names":[],"sourceRoot":""}
@@ -0,0 +1,11 @@
1
+ (self["webpackChunk_thinkable_labs_lower_third_generator"] = self["webpackChunk_thinkable_labs_lower_third_generator"] || []).push([[242],{
2
+
3
+ /***/ 5242
4
+ () {
5
+
6
+ /* (ignored) */
7
+
8
+ /***/ }
9
+
10
+ }]);
11
+ //# sourceMappingURL=242.bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"242.bundle.js","mappings":";;;;;AAAA","sources":["ignored|/Users/lee.marreros/Documents/Freelance/audio-qc-tool/node_modules/mediabunny/dist/modules/src|./node.js"],"sourcesContent":["/* (ignored) */"],"names":[],"sourceRoot":""}