diff --git a/.dockerignore b/.dockerignore
index 32ba4dd..5fd8d63 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -15,6 +15,12 @@ ENV/
*.egg-info/
.pytest_cache/
+# Node
+node_modules/
+remotion/node_modules/
+render-service/node_modules/
+dashboard/node_modules/
+
# IDE
.idea/
.vscode/
diff --git a/app.py b/app.py
index 1a1e0ac..0394b8e 100644
--- a/app.py
+++ b/app.py
@@ -532,6 +532,191 @@ class SubtitleRequest(BaseModel):
bg_opacity: float = 0.0
input_filename: Optional[str] = None
+
+@app.get("/api/clip/{job_id}/{clip_index}/transcript")
+async def get_clip_transcript(job_id: str, clip_index: int):
+ """Return word-level captions for a specific clip, formatted for Remotion."""
+ if job_id not in jobs:
+ raise HTTPException(status_code=404, detail="Job not found")
+
+ output_dir = os.path.join(OUTPUT_DIR, job_id)
+ json_files = glob.glob(os.path.join(output_dir, "*_metadata.json"))
+
+ if not json_files:
+ raise HTTPException(status_code=404, detail="Metadata not found")
+
+ with open(json_files[0], 'r') as f:
+ data = json.load(f)
+
+ transcript = data.get('transcript')
+ if not transcript:
+ raise HTTPException(status_code=400, detail="Transcript not found in metadata")
+
+ clips = data.get('shorts', [])
+ if clip_index >= len(clips):
+ raise HTTPException(status_code=404, detail="Clip not found")
+
+ clip_data = clips[clip_index]
+ clip_start = clip_data.get('start', 0)
+ clip_end = clip_data.get('end', 0)
+
+ # Extract words within clip range and convert to CaptionWord format
+ captions = []
+ for segment in transcript.get('segments', []):
+ for word_info in segment.get('words', []):
+ if word_info['end'] > clip_start and word_info['start'] < clip_end:
+ captions.append({
+ "text": word_info.get('word', '').strip(),
+ "startMs": int((max(0, word_info['start'] - clip_start)) * 1000),
+ "endMs": int((max(0, word_info['end'] - clip_start)) * 1000),
+ })
+
+ duration_sec = clip_end - clip_start
+
+ return {
+ "captions": captions,
+ "durationSec": duration_sec,
+ "language": transcript.get('language', 'en'),
+ }
+
+
+# --- Remotion Render Proxy ---
+RENDER_SERVICE_URL = os.getenv("RENDER_SERVICE_URL", "http://renderer:3100")
+
+@app.post("/api/render")
+async def proxy_render(request: Request):
+ """Proxy render requests to the Node.js Remotion render service."""
+ import httpx
+ body = await request.json()
+ try:
+ async with httpx.AsyncClient(timeout=30.0) as client:
+ resp = await client.post(f"{RENDER_SERVICE_URL}/render", json=body)
+ return resp.json()
+ except Exception as e:
+ raise HTTPException(status_code=502, detail=f"Render service unavailable: {e}")
+
+@app.get("/api/render/{render_id}")
+async def proxy_render_status(render_id: str):
+ """Proxy render status polling to the Node.js Remotion render service."""
+ import httpx
+ try:
+ async with httpx.AsyncClient(timeout=10.0) as client:
+ resp = await client.get(f"{RENDER_SERVICE_URL}/render/{render_id}")
+ return resp.json()
+ except Exception as e:
+ raise HTTPException(status_code=502, detail=f"Render service unavailable: {e}")
+
+
+class EffectsGenerateRequest(BaseModel):
+ job_id: str
+ clip_index: int
+ input_filename: Optional[str] = None
+
+@app.post("/api/effects/generate")
+async def generate_effects_config(
+ req: EffectsGenerateRequest,
+ x_gemini_key: Optional[str] = Header(None, alias="X-Gemini-Key")
+):
+ """Generate structured EffectsConfig JSON for Remotion rendering via Gemini AI."""
+ final_api_key = x_gemini_key or os.environ.get("GEMINI_API_KEY")
+
+ if not final_api_key:
+ raise HTTPException(status_code=400, detail="Missing Gemini API Key (Header)")
+
+ if req.job_id not in jobs:
+ raise HTTPException(status_code=404, detail="Job not found")
+
+ job = jobs[req.job_id]
+ if 'result' not in job or 'clips' not in job['result']:
+ raise HTTPException(status_code=400, detail="Job result not available")
+
+ try:
+ # Resolve input path
+ if req.input_filename:
+ safe_name = os.path.basename(req.input_filename)
+ input_path = os.path.join(OUTPUT_DIR, req.job_id, safe_name)
+ else:
+ clip = job['result']['clips'][req.clip_index]
+ filename = clip['video_url'].split('/')[-1]
+ input_path = os.path.join(OUTPUT_DIR, req.job_id, filename)
+
+ if not os.path.exists(input_path):
+ raise HTTPException(status_code=404, detail=f"Video file not found: {input_path}")
+
+ def run_effects_generation():
+ editor = VideoEditor(api_key=final_api_key)
+
+ # Create safe ASCII filename to avoid encoding issues
+ safe_filename = f"temp_effects_{req.job_id}.mp4"
+ safe_input_path = os.path.join(OUTPUT_DIR, req.job_id, safe_filename)
+ shutil.copy(input_path, safe_input_path)
+
+ try:
+ # Upload video to Gemini
+ vid_file = editor.upload_video(safe_input_path)
+
+ # Get video metadata via ffprobe
+ probe_cmd = [
+ 'ffprobe', '-v', 'error',
+ '-select_streams', 'v:0',
+ '-show_entries', 'stream=width,height,r_frame_rate,duration',
+ '-show_entries', 'format=duration',
+ '-of', 'json',
+ safe_input_path
+ ]
+ probe_result = subprocess.check_output(probe_cmd).decode().strip()
+ probe_data = json.loads(probe_result)
+
+ stream = probe_data.get('streams', [{}])[0]
+ width = int(stream.get('width', 1080))
+ height = int(stream.get('height', 1920))
+
+ # Parse fps from r_frame_rate (e.g. "30/1")
+ r_frame_rate = stream.get('r_frame_rate', '30/1')
+ num, den = r_frame_rate.split('/')
+ fps = round(int(num) / int(den), 2)
+
+ # Get duration from stream or format
+ duration = float(stream.get('duration', 0))
+ if duration == 0:
+ duration = float(probe_data.get('format', {}).get('duration', 0))
+
+ # Load transcript from metadata
+ transcript = None
+ try:
+ meta_files = glob.glob(os.path.join(OUTPUT_DIR, req.job_id, "*_metadata.json"))
+ if meta_files:
+ with open(meta_files[0], 'r') as f:
+ data = json.load(f)
+ transcript = data.get('transcript')
+ except Exception as e:
+ print(f"⚠️ Could not load transcript for effects config: {e}")
+
+ # Generate effects config
+ effects_config = editor.get_effects_config(
+ vid_file, duration, fps=fps, width=width, height=height, transcript=transcript
+ )
+
+ return effects_config
+ finally:
+ if os.path.exists(safe_input_path):
+ os.remove(safe_input_path)
+
+ loop = asyncio.get_event_loop()
+ effects_config = await loop.run_in_executor(None, run_effects_generation)
+
+ if effects_config is None:
+ raise HTTPException(status_code=500, detail="Failed to generate effects config from Gemini")
+
+ return {"effects": effects_config}
+
+ except HTTPException:
+ raise
+ except Exception as e:
+ print(f"❌ Effects Generation Error: {e}")
+ raise HTTPException(status_code=500, detail=str(e))
+
+
@app.post("/api/subtitle")
async def add_subtitles(req: SubtitleRequest):
if req.job_id not in jobs:
diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json
index c6db8ea..a25c443 100644
--- a/dashboard/package-lock.json
+++ b/dashboard/package-lock.json
@@ -1,16 +1,22 @@
{
- "name": "dashboard",
+ "name": "openshorts-app",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "dashboard",
+ "name": "openshorts-app",
"version": "0.0.0",
"dependencies": {
+ "@remotion/media": "^4.0.447",
+ "@remotion/media-utils": "^4.0.447",
+ "@remotion/player": "^4.0.447",
+ "@remotion/web-renderer": "^4.0.447",
"lucide-react": "^0.344.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "remotion": "^4.0.447",
+ "zod": "^4.3.6"
},
"devDependencies": {
"@types/react": "^18.2.64",
@@ -792,6 +798,45 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "node_modules/@mediabunny/aac-encoder": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/@mediabunny/aac-encoder/-/aac-encoder-1.39.2.tgz",
+ "integrity": "sha512-KD6KADVzAnW7tqhRFGBOX4uaiHbd0Yxvg0lfthj3wJLAEEgEBAvi43w+ZXWeEn54X/jpabrLe4bW/eYFFvlbUA==",
+ "license": "MPL-2.0",
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/Vanilagy"
+ },
+ "peerDependencies": {
+ "mediabunny": "^1.0.0"
+ }
+ },
+ "node_modules/@mediabunny/flac-encoder": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/@mediabunny/flac-encoder/-/flac-encoder-1.39.2.tgz",
+ "integrity": "sha512-VwBr3AzZTPEEPvt4aladZiXwOf3W293eq213zDupGQi/taS8WWNqDd3eBdf8FfvlbXATfbRiycXDKyQ0HlOZaQ==",
+ "license": "MPL-2.0",
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/Vanilagy"
+ },
+ "peerDependencies": {
+ "mediabunny": "^1.0.0"
+ }
+ },
+ "node_modules/@mediabunny/mp3-encoder": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/@mediabunny/mp3-encoder/-/mp3-encoder-1.39.2.tgz",
+ "integrity": "sha512-3rrodrGnUpUP8F2d1aRUl8IvjqK3jegkupbOzvOokooSAO5rXk2Lr5jZe7TnPeiVGiXfmnoJ7s9uyUOHlCd8qw==",
+ "license": "MPL-2.0",
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/Vanilagy"
+ },
+ "peerDependencies": {
+ "mediabunny": "^1.0.0"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -827,6 +872,71 @@
"node": ">= 8"
}
},
+ "node_modules/@remotion/licensing": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/licensing/-/licensing-4.0.447.tgz",
+ "integrity": "sha512-/pqArZCErkX0jVroK6tvTLuWpgFGiu/z5nTyCkaQogg6xvQKi7QQBXBb8mUJ/BvUeiWOUX/eVJ2khDGhSzQpUQ==",
+ "license": "MIT"
+ },
+ "node_modules/@remotion/media": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/media/-/media-4.0.447.tgz",
+ "integrity": "sha512-WWwOXAToVjwNxh9SfbBpdOweqbpOXLNoC7AaGKEv+AAH1RxVfNhc8ZzfFUgCtD7aBH4HHjva/Beca0C6LLVwKA==",
+ "dependencies": {
+ "mediabunny": "1.39.2",
+ "remotion": "4.0.447",
+ "zod": "4.3.6"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.0",
+ "react-dom": ">=16.8.0"
+ }
+ },
+ "node_modules/@remotion/media-utils": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/media-utils/-/media-utils-4.0.447.tgz",
+ "integrity": "sha512-PltvSZsY+By8DlsZeAN63D1cMsgXewCqEq39nJrO0VZVc5nnWyd+nvMZz9yhGsoMo2Z5xNkfZhPkl+Gs25wn0Q==",
+ "license": "MIT",
+ "dependencies": {
+ "mediabunny": "1.39.2",
+ "remotion": "4.0.447"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.0",
+ "react-dom": ">=16.8.0"
+ }
+ },
+ "node_modules/@remotion/player": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/player/-/player-4.0.447.tgz",
+ "integrity": "sha512-xKpdzlE8Gyceir/irJ2qsBK3hKJfILSTxQAQUtDWykehhC/OpizS9yl2//ZWghid9nNAL49QkbFcsqdcgcMocQ==",
+ "license": "SEE LICENSE IN LICENSE.md",
+ "dependencies": {
+ "remotion": "4.0.447"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.0",
+ "react-dom": ">=16.8.0"
+ }
+ },
+ "node_modules/@remotion/web-renderer": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/web-renderer/-/web-renderer-4.0.447.tgz",
+ "integrity": "sha512-gzLLbglpu2DyH/WUywi599QICkcFjSf8VwANsLIUL/tUlr8RHjiJWr6XBgWYHHBtAXipRlmW7hRvP16j3wICiQ==",
+ "license": "UNLICENSED",
+ "dependencies": {
+ "@mediabunny/aac-encoder": "1.39.2",
+ "@mediabunny/flac-encoder": "1.39.2",
+ "@mediabunny/mp3-encoder": "1.39.2",
+ "@remotion/licensing": "4.0.447",
+ "mediabunny": "1.39.2",
+ "remotion": "4.0.447"
+ },
+ "peerDependencies": {
+ "react": ">=18.0.0",
+ "react-dom": ">=18.0.0"
+ }
+ },
"node_modules/@rolldown/pluginutils": {
"version": "1.0.0-beta.27",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
@@ -874,6 +984,21 @@
"@babel/types": "^7.28.2"
}
},
+ "node_modules/@types/dom-mediacapture-transform": {
+ "version": "0.1.11",
+ "resolved": "https://registry.npmjs.org/@types/dom-mediacapture-transform/-/dom-mediacapture-transform-0.1.11.tgz",
+ "integrity": "sha512-Y2p+nGf1bF2XMttBnsVPHUWzRRZzqUoJAKmiP10b5umnO6DDrWI0BrGDJy1pOHoOULVmGSfFNkQrAlC5dcj6nQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/dom-webcodecs": "*"
+ }
+ },
+ "node_modules/@types/dom-webcodecs": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.13.tgz",
+ "integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ==",
+ "license": "MIT"
+ },
"node_modules/@types/prop-types": {
"version": "15.7.15",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
@@ -3190,6 +3315,23 @@
"node": ">= 0.4"
}
},
+ "node_modules/mediabunny": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.39.2.tgz",
+ "integrity": "sha512-VcrisGRt+OI7tTPrziucJoCIPYIS/DEWY37TqzQVLWSUUHiyvsiRizEypQ3FOlhfIZ4ytAG/Mw4zxfetCTyKUg==",
+ "license": "MPL-2.0",
+ "workspaces": [
+ "packages/*"
+ ],
+ "dependencies": {
+ "@types/dom-mediacapture-transform": "^0.1.11",
+ "@types/dom-webcodecs": "0.1.13"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/Vanilagy"
+ }
+ },
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -3879,6 +4021,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/remotion": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/remotion/-/remotion-4.0.447.tgz",
+ "integrity": "sha512-p2J+iGxmBL4TDUeAAlXrfxl9SfU/GRJEoVUpqJGYP8YJw/IKT2WbXngXHf4UWE0R2MHYAVtznuA640ktSSJwWw==",
+ "license": "SEE LICENSE IN LICENSE.md",
+ "peerDependencies": {
+ "react": ">=16.8.0",
+ "react-dom": ">=16.8.0"
+ }
+ },
"node_modules/resolve": {
"version": "2.0.0-next.5",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz",
@@ -4858,6 +5010,15 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
+ },
+ "node_modules/zod": {
+ "version": "4.3.6",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",
+ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
}
},
"dependencies": {
@@ -5314,6 +5475,24 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "@mediabunny/aac-encoder": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/@mediabunny/aac-encoder/-/aac-encoder-1.39.2.tgz",
+ "integrity": "sha512-KD6KADVzAnW7tqhRFGBOX4uaiHbd0Yxvg0lfthj3wJLAEEgEBAvi43w+ZXWeEn54X/jpabrLe4bW/eYFFvlbUA==",
+ "requires": {}
+ },
+ "@mediabunny/flac-encoder": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/@mediabunny/flac-encoder/-/flac-encoder-1.39.2.tgz",
+ "integrity": "sha512-VwBr3AzZTPEEPvt4aladZiXwOf3W293eq213zDupGQi/taS8WWNqDd3eBdf8FfvlbXATfbRiycXDKyQ0HlOZaQ==",
+ "requires": {}
+ },
+ "@mediabunny/mp3-encoder": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/@mediabunny/mp3-encoder/-/mp3-encoder-1.39.2.tgz",
+ "integrity": "sha512-3rrodrGnUpUP8F2d1aRUl8IvjqK3jegkupbOzvOokooSAO5rXk2Lr5jZe7TnPeiVGiXfmnoJ7s9uyUOHlCd8qw==",
+ "requires": {}
+ },
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -5340,6 +5519,51 @@
"fastq": "^1.6.0"
}
},
+ "@remotion/licensing": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/licensing/-/licensing-4.0.447.tgz",
+ "integrity": "sha512-/pqArZCErkX0jVroK6tvTLuWpgFGiu/z5nTyCkaQogg6xvQKi7QQBXBb8mUJ/BvUeiWOUX/eVJ2khDGhSzQpUQ=="
+ },
+ "@remotion/media": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/media/-/media-4.0.447.tgz",
+ "integrity": "sha512-WWwOXAToVjwNxh9SfbBpdOweqbpOXLNoC7AaGKEv+AAH1RxVfNhc8ZzfFUgCtD7aBH4HHjva/Beca0C6LLVwKA==",
+ "requires": {
+ "mediabunny": "1.39.2",
+ "remotion": "4.0.447",
+ "zod": "4.3.6"
+ }
+ },
+ "@remotion/media-utils": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/media-utils/-/media-utils-4.0.447.tgz",
+ "integrity": "sha512-PltvSZsY+By8DlsZeAN63D1cMsgXewCqEq39nJrO0VZVc5nnWyd+nvMZz9yhGsoMo2Z5xNkfZhPkl+Gs25wn0Q==",
+ "requires": {
+ "mediabunny": "1.39.2",
+ "remotion": "4.0.447"
+ }
+ },
+ "@remotion/player": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/player/-/player-4.0.447.tgz",
+ "integrity": "sha512-xKpdzlE8Gyceir/irJ2qsBK3hKJfILSTxQAQUtDWykehhC/OpizS9yl2//ZWghid9nNAL49QkbFcsqdcgcMocQ==",
+ "requires": {
+ "remotion": "4.0.447"
+ }
+ },
+ "@remotion/web-renderer": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/@remotion/web-renderer/-/web-renderer-4.0.447.tgz",
+ "integrity": "sha512-gzLLbglpu2DyH/WUywi599QICkcFjSf8VwANsLIUL/tUlr8RHjiJWr6XBgWYHHBtAXipRlmW7hRvP16j3wICiQ==",
+ "requires": {
+ "@mediabunny/aac-encoder": "1.39.2",
+ "@mediabunny/flac-encoder": "1.39.2",
+ "@mediabunny/mp3-encoder": "1.39.2",
+ "@remotion/licensing": "4.0.447",
+ "mediabunny": "1.39.2",
+ "remotion": "4.0.447"
+ }
+ },
"@rolldown/pluginutils": {
"version": "1.0.0-beta.27",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
@@ -5387,6 +5611,19 @@
"@babel/types": "^7.28.2"
}
},
+ "@types/dom-mediacapture-transform": {
+ "version": "0.1.11",
+ "resolved": "https://registry.npmjs.org/@types/dom-mediacapture-transform/-/dom-mediacapture-transform-0.1.11.tgz",
+ "integrity": "sha512-Y2p+nGf1bF2XMttBnsVPHUWzRRZzqUoJAKmiP10b5umnO6DDrWI0BrGDJy1pOHoOULVmGSfFNkQrAlC5dcj6nQ==",
+ "requires": {
+ "@types/dom-webcodecs": "*"
+ }
+ },
+ "@types/dom-webcodecs": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.13.tgz",
+ "integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ=="
+ },
"@types/prop-types": {
"version": "15.7.15",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
@@ -7016,6 +7253,15 @@
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"dev": true
},
+ "mediabunny": {
+ "version": "1.39.2",
+ "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.39.2.tgz",
+ "integrity": "sha512-VcrisGRt+OI7tTPrziucJoCIPYIS/DEWY37TqzQVLWSUUHiyvsiRizEypQ3FOlhfIZ4ytAG/Mw4zxfetCTyKUg==",
+ "requires": {
+ "@types/dom-mediacapture-transform": "^0.1.11",
+ "@types/dom-webcodecs": "0.1.13"
+ }
+ },
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -7455,6 +7701,12 @@
"set-function-name": "^2.0.2"
}
},
+ "remotion": {
+ "version": "4.0.447",
+ "resolved": "https://registry.npmjs.org/remotion/-/remotion-4.0.447.tgz",
+ "integrity": "sha512-p2J+iGxmBL4TDUeAAlXrfxl9SfU/GRJEoVUpqJGYP8YJw/IKT2WbXngXHf4UWE0R2MHYAVtznuA640ktSSJwWw==",
+ "requires": {}
+ },
"resolve": {
"version": "2.0.0-next.5",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz",
@@ -8100,6 +8352,11 @@
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true
+ },
+ "zod": {
+ "version": "4.3.6",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",
+ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="
}
}
}
diff --git a/dashboard/package.json b/dashboard/package.json
index 8c04ce5..0748bc8 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -10,9 +10,15 @@
"preview": "vite preview"
},
"dependencies": {
+ "@remotion/media": "^4.0.447",
+ "@remotion/media-utils": "^4.0.447",
+ "@remotion/player": "^4.0.447",
+ "@remotion/web-renderer": "^4.0.447",
"lucide-react": "^0.344.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "remotion": "^4.0.447",
+ "zod": "^4.3.6"
},
"devDependencies": {
"@types/react": "^18.2.64",
@@ -27,4 +33,4 @@
"tailwindcss": "^3.4.19",
"vite": "^4.5.3"
}
-}
\ No newline at end of file
+}
diff --git a/dashboard/src/components/HookModal.jsx b/dashboard/src/components/HookModal.jsx
index 93a896f..db50e25 100644
--- a/dashboard/src/components/HookModal.jsx
+++ b/dashboard/src/components/HookModal.jsx
@@ -1,14 +1,35 @@
import React, { useState } from 'react';
-import { X, Sparkles, Loader2, Maximize, MoveVertical } from 'lucide-react';
+import { X, Sparkles, Loader2, Maximize, MoveVertical, Zap } from 'lucide-react';
+import RemotionPreview from './RemotionPreview';
-export default function HookModal({ isOpen, onClose, onGenerate, isProcessing, videoUrl, initialText }) {
+const ENTRANCE_OPTIONS = [
+ { value: 'spring', label: 'Bounce' },
+ { value: 'fade', label: 'Fade' },
+ { value: 'slide-up', label: 'Slide Up' },
+ { value: 'none', label: 'None' },
+];
+
+export default function HookModal({ isOpen, onClose, onGenerate, isProcessing, videoUrl, initialText, durationInSeconds, existingSubtitles }) {
const [text, setText] = useState(initialText || 'POV: You are using the viral hook feature');
- const [position, setPosition] = useState('top'); // top, center, bottom
- const [size, setSize] = useState('M'); // S, M, L
+ const [position, setPosition] = useState('top');
+ const [size, setSize] = useState('M');
+ const [entranceAnimation, setEntranceAnimation] = useState('spring');
+ const [displayDuration, setDisplayDuration] = useState(5);
if (!isOpen) return null;
- // Preview Logic
+ // Build hook config for Remotion preview
+ const hookConfig = {
+ text: text || 'Enter your text...',
+ position,
+ size,
+ entranceAnimation,
+ displayDurationSec: displayDuration,
+ };
+
+ const useRemotionPreview = !!videoUrl;
+
+ // Fallback preview logic (same as original)
const getPositionClass = () => {
switch (position) {
case 'center': return 'items-center justify-center';
@@ -37,26 +58,35 @@ export default function HookModal({ isOpen, onClose, onGenerate, isProcessing, v
{/* Left: Preview */}
-
-
- {/* Hook Overlay Preview */}
-
-
- {text || "Enter your text..."}
-
-
+ {useRemotionPreview ? (
+
+ ) : (
+ <>
+
+
+
+ {text || "Enter your text..."}
+
+
+ >
+ )}
{/* Right: Controls */}
@@ -120,13 +150,55 @@ export default function HookModal({ isOpen, onClose, onGenerate, isProcessing, v
+ {/* Entrance Animation (new) */}
+
+
+
+ {ENTRANCE_OPTIONS.map((opt) => (
+
+ ))}
+
+
+
+ {/* Display Duration (new) */}
+
+
+
setDisplayDuration(parseInt(e.target.value))}
+ className="w-full accent-yellow-500"
+ />
+
+ 2s
+ 15s
+
+
+
Tip: Keep it short and punchy. Using "POV:" or specific questions works best for retention.