POST /api/generate-ad-video
Takes thevideo_id and analysis output from POST /api/analyze-video, generates a static ad frame using Gemini and a voiceover using ElevenLabs, then splices the result into the cached clip with ffmpeg.
ffmpeg must be installed and available on PATH. The server will return 500 if ffmpeg is missing or exits with an error.Request
Send the request asmultipart/form-data.
The UUID returned by
/api/analyze-video. Must refer to a video still in the server cache (within 30 minutes of the analyze call).The full response object from
/api/analyze-video, serialized as a JSON string.The product to display in the ad segment.
Response
Always
"success" on a successful response.Server-relative path to the merged output video, e.g.
"/api/output/abc123_edited.mp4". Serve this path with GET /api/output/.The voiceover line that was generated and included in the ad segment, e.g.
"Oh wow, a 2025 Toyota RAV4 XLE Hybrid AWD."Example
Errors
| Status | Cause |
|---|---|
400 | Any required field (video_id, analysis, product_name) is missing. |
400 | analysis is not valid JSON. |
400 | Ad timestamp from analysis falls too close to the end of the video. |
404 | video_id not found — cache expired or invalid UUID. |
500 | ffmpeg processing failed. |
503 | GEMINI_API_KEY is not configured. |