Create Stunning Videos from Images and Text with chrypnotoad/chamuel-wan Cognitive Actions

25 Apr 2025
Create Stunning Videos from Images and Text with chrypnotoad/chamuel-wan Cognitive Actions

In the realm of content creation, the ability to generate videos from static images and descriptive text prompts can significantly enhance storytelling and engagement. The chrypnotoad/chamuel-wan Cognitive Actions provide developers with powerful tools to create dynamic video content seamlessly. This blog post will walk you through how to leverage the "Generate Video from Image and Text Prompt" action, exploring its capabilities, input requirements, and how to integrate it into your applications.

Prerequisites

Before diving into the implementation, ensure you have the following:

  • An API key for the Cognitive Actions platform.
  • Basic understanding of JSON and HTTP requests.
  • A suitable environment for executing Python code.

Authentication is typically handled by including the API key in the headers of your requests, ensuring secure access to the Cognitive Actions functionality.

Cognitive Actions Overview

Generate Video from Image and Text Prompt

The Generate Video from Image and Text Prompt action creates a video using a specified image as the starting frame, guided by a descriptive text prompt. This innovative action allows for customization with various parameters, such as speed and quality, enabling you to tailor video content to your needs.

Input

The input for this action requires a JSON payload structured according to the following schema:

{
  "prompt": "A detailed description of the video content.",
  "image": "https://example.com/image.jpg",
  "frameCount": 81,
  "guideScale": 5,
  "shiftFactor": 8,
  "clipStrength": 1,
  "modelStrength": 1,
  "generationSpeed": "Balanced",
  "generationSteps": 30,
  "videoResolution": "480p",
  "videoAspectRatio": "16:9",
  "excludePrompt": ""
}

Here's an example input demonstrating the required fields:

{
  "prompt": "The Empress is a beautiful, full-figured woman with blonde hair and a peaceful aura about her. On her head, she wears a crown of twelve stars, showing her connection with the mystical realm and the cycles of the natural world.",
  "frameCount": 81,
  "guideScale": 5,
  "shiftFactor": 8,
  "clipStrength": 1,
  "modelStrength": 1,
  "generationSteps": 30,
  "videoAspectRatio": "9:16"
}

Output

Upon successful execution, the action returns a URL pointing to the generated video. The output structure looks like this:

[
  "https://assets.cognitiveactions.com/invocations/dd9ae27b-2c50-4362-8f85-c5452d7880ea/3fc7ebb3-871c-460d-aa04-ca6d1814d3f2.mp4"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet illustrating how a developer might call the Cognitive Actions endpoint to generate a video:

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 = "acfa95a2-6491-476a-9cc1-719a7dda35c6"  # Action ID for Generate Video from Image and Text Prompt

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "The Empress is a beautiful, full-figured woman with blonde hair and a peaceful aura about her. On her head, she wears a crown of twelve stars.",
    "frameCount": 81,
    "guideScale": 5,
    "shiftFactor": 8,
    "clipStrength": 1,
    "modelStrength": 1,
    "generationSteps": 30,
    "videoAspectRatio": "9:16"
}

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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable should be structured according to the action's requirements. The endpoint URL and request structure provided are illustrative and may differ in your actual implementation.

Conclusion

The Generate Video from Image and Text Prompt action within the chrypnotoad/chamuel-wan Cognitive Actions suite empowers developers to create engaging video content efficiently. By leveraging this action, you can enhance user experiences and storytelling capabilities in your applications. Consider exploring various use cases, such as marketing videos, educational content, or even artistic expressions, to fully harness the potential of this innovative tool. Happy coding!