Create Stunning Videos with the LTX-Video Cognitive Actions

23 Apr 2025
Create Stunning Videos with the LTX-Video Cognitive Actions

In the world of digital content creation, the ability to generate high-quality videos quickly and efficiently is a game-changer. The LTX-Video Cognitive Actions provide developers with powerful tools to create realistic video content in real-time. Leveraging cutting-edge DiT-based models, these actions allow for both text-to-video and image+text-to-video applications, significantly enhancing the content creation process.

In this guide, we'll explore how to integrate the Generate Real-Time High-Quality Videos action into your applications, detailing its capabilities, input requirements, and output results.

Prerequisites

To get started with LTX-Video Cognitive Actions, you will need:

  • An API key for the Cognitive Actions platform.
  • Basic knowledge of JSON for structuring your requests.

Authentication is typically handled by passing your API key in the request headers, ensuring secure and authorized access to the actions.

Cognitive Actions Overview

Generate Real-Time High-Quality Videos

The Generate Real-Time High-Quality Videos action empowers developers to create high-quality videos at 24 frames per second, with a resolution of 768x512. This action excels in producing realistic and diverse video content faster than real-time playback.

Input

The action accepts a variety of parameters to customize the video generation:

  • seed (integer, optional): Sets a specific seed for reproducibility. If not specified, a random seed is used by default.
  • image (string, optional): A URI pointing to an optional input image used as the starting frame for the video generation.
  • steps (integer, optional, default: 30): Specifies the number of steps for generating the video (1-50).
  • prompt (string, required): Detailed text prompt describing the desired video content.
  • negativePrompt (string, optional): Specifies elements to exclude from the video output (e.g., low quality, distortions).
  • outputTargetSize (integer, optional, default: 640): Defines the target resolution for the width of the output video in pixels (options: 512-1024).
  • outputAspectRatio (string, optional, default: "3:2"): Specifies the aspect ratio of the output video.
  • outputFrameLength (integer, optional, default: 97): Determines the length of the output video in frames (options: 97, 129, 161, 193, 225, 257).
  • videoFollowStrength (number, optional, default: 3): Indicates how closely the video should adhere to the provided prompt (1-20).

Example Input:

{
  "steps": 30,
  "prompt": "A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
  "negativePrompt": "low quality, worst quality, deformed, distorted, watermark",
  "outputTargetSize": 640,
  "outputAspectRatio": "16:9",
  "outputFrameLength": 97,
  "videoFollowStrength": 3
}

Output

Upon successful execution, this action returns a URL pointing to the generated video.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/6eee093f-a997-4a5f-b605-cbc1b134209b/47660655-20b7-4508-a89e-cbb3bc533399.mp4"
]

Conceptual Usage Example (Python)

Here's a conceptual example of how you might call the Generate Real-Time High-Quality Videos action using Python:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"  # Hypothetical endpoint

action_id = "64998ae9-5971-448c-b14f-e2212011ac90"  # Action ID for Generate Real-Time High-Quality Videos

# Construct the input payload based on the action's requirements
payload = {
    "steps": 30,
    "prompt": "A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.",
    "negativePrompt": "low quality, worst quality, deformed, distorted, watermark",
    "outputTargetSize": 640,
    "outputAspectRatio": "16:9",
    "outputFrameLength": 97,
    "videoFollowStrength": 3
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}  # Hypothetical structure
    )
    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this code snippet, you would replace the API key and endpoint with your actual values. The payload is structured to meet the required input fields for the action. The response will provide you with the link to the generated video.

Conclusion

The LTX-Video Cognitive Actions enable developers to create stunning videos quickly and effectively, opening new avenues for content generation across various applications. By integrating the Generate Real-Time High-Quality Videos action, you can enhance your projects with high-quality, realistic video content. Consider experimenting with different prompts and parameters to explore the full potential of this powerful tool!