Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:869413421 Ai moive studio MovieVideoService synthesize movie from transitions

From Leeroopedia
Knowledge Sources
Domains Video, Multimedia
Last Updated 2026-10-23 12:00 GMT

Overview

Service that composes the final AI movie by downloading all transition videos, concatenating with FFmpeg (fast mode), mixing BGM, and uploading to MinIO.

Description

MovieVideoService.synthesize_movie_from_transitions is the final stage of the AI Movie Pipeline. It manages a task state machine (VALIDATING → DOWNLOADING_MATERIALS → CONCATENATING → UPLOADING → completed):

1. Loads all MovieShotTransition records with video_url for the chapter, ordered by order_index 2. Validates transition video completeness 3. Concurrently downloads all transition videos to a temp directory 4. Concatenates using FFmpeg in fast mode (no crossfade for transitions, since transitions already contain motion) 5. Optionally mixes BGM if a background_id is set 6. Uploads the final MP4 to MinIO 7. Updates chapter video_url and video_duration

Usage

Import when composing the final movie from transition videos. Called by the movie composition Celery task.

Code Reference

Source Location

  • Repository: ai-moive-studio
  • File: backend/src/services/movie_video_service.py:L350-458

Signature

class MovieVideoService(BaseService):
    async def synthesize_movie_from_transitions(self, video_task_id: str) -> dict:
        """
        Args:
            video_task_id: video task UUID

        Returns:
            Dict with total_transitions, video_key, duration
        """

Import

from src.services.movie_video_service import MovieVideoService

I/O Contract

Inputs

Name Type Required Description
video_task_id str Yes Video task UUID

Outputs

Name Type Description
return value dict {total_transitions, video_key, duration}
DB side effects — Updates VideoTask, Chapter.video_url, Chapter.video_duration; uploads MP4 to MinIO

Usage Examples

Composing a Movie

from src.services.movie_video_service import MovieVideoService

service = MovieVideoService(db_session)
result = await service.synthesize_movie_from_transitions(
    video_task_id="task-uuid"
)
print(f"Movie: {result['video_key']}, Duration: {result['duration']}s")

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment