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 TransitionService batch generate transition videos

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

Overview

Service that batch-submits pending transition video generation tasks to an AI video model, using independent database sessions per worker and keyframe reference images.

Description

TransitionService.batch_generate_transition_videos loads all pending transitions with video prompts, creates a GatewayProvider, and concurrently submits video generation tasks. Each worker uses an independent database session to avoid connection conflicts.

For each transition, the worker loads the from_shot and to_shot keyframes, passes them as reference images to GatewayProvider.create_video, and updates the transition status to processing with the video_task_id and provider_context_json.

Usage

Import when generating transition videos for AI movie generation. Called by the movie generation pipeline after transition creation.

Code Reference

Source Location

  • Repository: ai-moive-studio
  • File: backend/src/services/transition_service.py:L476-589

Signature

class TransitionService(BaseService):
    async def batch_generate_transition_videos(
        self,
        script_id: str,
        api_key_id: str,
        video_model: str
    ) -> dict:
        """
        Args:
            script_id: script UUID
            api_key_id: API key UUID
            video_model: video generation model name

        Returns:
            Dict with total, success, failed
        """

Import

from src.services.transition_service import TransitionService

I/O Contract

Inputs

Name Type Required Description
script_id str Yes Script UUID
api_key_id str Yes API key UUID
video_model str Yes Video generation model name

Outputs

Name Type Description
return value dict {total, success, failed}
DB side effects — Updates transition status to "processing", sets video_task_id and provider_context_json

Usage Examples

Generating Transition Videos

from src.services.transition_service import TransitionService

service = TransitionService(db_session)
result = await service.batch_generate_transition_videos(
    script_id="script-uuid",
    api_key_id="key-uuid",
    video_model="wan2.1",
)
print(f"Submitted {result['success']}/{result['total']} video tasks")

Related Pages

Implements Principle

Uses Heuristic

Page Connections

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