clipwright/remotion/src/compositions/ShortVideo.tsx
juancarlos.cavero 9c9342c499 feat: Add Remotion integration for animated subtitles, hooks and effects
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>
2026-04-10 14:00:11 +02:00

33 lines
1.1 KiB
TypeScript

import React from "react";
import { AbsoluteFill } from "remotion";
import { Video } from "@remotion/media";
import type { ShortVideoProps } from "../lib/types";
import { Subtitles } from "./Subtitles";
import { HookOverlay } from "./HookOverlay";
import { VideoEffects } from "./VideoEffects";
/**
* Main composition that layers all post-processing on top of the base video.
* Uses @remotion/media Video for browser-side rendering compatibility.
*/
export const ShortVideo: React.FC<Record<string, unknown>> = (rawProps) => {
const { videoUrl, subtitles, hook, effects } =
rawProps as unknown as ShortVideoProps;
return (
<AbsoluteFill style={{ backgroundColor: "#000" }}>
{/* Layer 1: Base video with optional zoom/color effects */}
<VideoEffects config={effects}>
<Video
src={videoUrl}
style={{ width: "100%", height: "100%", objectFit: "cover" }}
/>
</VideoEffects>
{/* Layer 2: Animated subtitles */}
{subtitles && <Subtitles config={subtitles} />}
{/* Layer 3: Hook text overlay */}
{hook && <HookOverlay config={hook} />}
</AbsoluteFill>
);
};