Capítulo 491 de 988

Chapter 491: Triggering renders from Python

Core Idea

_available from v4. 0.

Key Concepts

  • Limitations
  • Rendering a video
  • Cancelling a render<AvailableFrom v="4.0.515" />
  • Large input props available from v4.0.315
  • Rendering an image
  • Breaking changes
  • 4.0.380
  • 4.0.82

Code Examples

from remotion_lambda import RenderMediaParams, Privacy, ValidStillImageFormats
from remotion_lambda import RemotionClient
import os
from dotenv import load_dotenv

load_dotenv()

# Load env variables
REMOTION_APP_REGION = os.getenv('REMOTION_APP_REGION')
if not REMOTION_APP_REGION:
    raise Exception("REMOTION_APP_REGION is not set")

REMOTION_APP_FUNCTION_NAME = os.getenv('REMOTION_APP_FUNCTION_NAME')
if not REMOTION_APP_FUNCTION_NAME:
    raise Exception("REMOTION_APP_FUNCTION_NAME is not set")

REMOTION_APP_SERVE_URL = os.getenv('REMOTION_APP_SERVE_URL')
if not REMOTION_APP_SERVE_URL:
    raise Exception("REMOTION_APP_SERVE_URL is not set")

# Construct client
client = RemotionClient(region=REMOTION_APP_REGION,
                        serve_url=REMOTION_APP_SERVE_URL,
                        function_name=REMOTION_APP_FUNCTION_NAME)

# Set render request
render_params = RenderMediaParams(
    composition="react-svg",
    privacy=Privacy.PUBLIC,
    image_format=ValidStillImageFormats.JPEG,
    input_props={
        'hi': 'there'
    },
)

render_response = client.render_media_on_lambda(render_params)
if render_response:
    # Execute render request

    print("Render ID:", render_response.render_id)
    print("Bucket name:", render_response.bucket_name)

    # Execute progress request
    progress_response = client.get_render_progress(
        render_id=render_response.rend
// ...(truncated)
  • What it demonstrates: Usage pattern for Triggering renders from Python from the official docs.

Key Takeaways

  1. Understand limitations when working with Triggering renders from Python.
  2. Understand rendering a video when working with Triggering renders from Python.
  3. Understand cancelling a render<availablefrom v="4.0.515" /> when working with Triggering renders from Python.
  4. Understand large input props available from v4.0.315 when working with Triggering renders from Python.
  5. Understand rendering an image when working with Triggering renders from Python.

Connects To

  • api: related page in the Lambda (@remotion/lambda) section.
  • Approuterwebhook: related page in the Lambda (@remotion/lambda) section.
  • Authentication: related page in the Lambda (@remotion/lambda) section.