Replace static FFmpeg post-processing with Remotion-powered browser rendering: - Animated word-by-word subtitles (pop, karaoke, glow styles) with real-time preview - Hook overlays with entrance animations (spring, fade, slide-up) - Video effects layer (zoom, brightness, contrast, saturate) - Browser-side rendering via @remotion/web-renderer (WebCodecs) - Editable transcript text in subtitle modal - Layers accumulate across operations (subtitles + hook rendered together) - Gemini EffectsConfig endpoint for structured JSON instead of fragile FFmpeg strings - Render service (Node.js) as alternative server-side renderer - New API endpoints: /api/clip/transcript, /api/effects/generate, /api/render Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import path from "node:path";
|
|
import { bundle } from "@remotion/bundler";
|
|
|
|
let bundleLocation: string | null = null;
|
|
|
|
/**
|
|
* Bundles the Remotion project on startup and caches the result.
|
|
* Uses REMOTION_BUNDLE_PATH env var to locate the remotion source
|
|
* (default: "../remotion" relative to this service's root).
|
|
*/
|
|
export async function initBundle(): Promise<void> {
|
|
const remotionRoot = process.env.REMOTION_BUNDLE_PATH
|
|
? path.resolve(process.env.REMOTION_BUNDLE_PATH)
|
|
: path.resolve(import.meta.dirname, "../../remotion");
|
|
|
|
const entryPoint = path.join(remotionRoot, "src", "index.ts");
|
|
|
|
console.log(`[bundle] Bundling Remotion project from: ${entryPoint}`);
|
|
|
|
bundleLocation = await bundle({
|
|
entryPoint,
|
|
onProgress: (progress: number) => {
|
|
if (progress % 10 === 0) {
|
|
console.log(`[bundle] Progress: ${progress}%`);
|
|
}
|
|
},
|
|
});
|
|
|
|
console.log(`[bundle] Bundle created at: ${bundleLocation}`);
|
|
}
|
|
|
|
/**
|
|
* Returns the cached bundle location.
|
|
* Throws if initBundle() has not been called yet.
|
|
*/
|
|
export function getBundleLocation(): string {
|
|
if (!bundleLocation) {
|
|
throw new Error(
|
|
"Bundle not initialized. Call initBundle() before getBundleLocation()."
|
|
);
|
|
}
|
|
return bundleLocation;
|
|
}
|