Create Stunning Videos from Images with fofr/wan-14b-cybercab Cognitive Actions

23 Apr 2025
Create Stunning Videos from Images with fofr/wan-14b-cybercab Cognitive Actions

In the world of digital content creation, the ability to transform static images into dynamic videos can significantly enhance user engagement. The fofr/wan-14b-cybercab Cognitive Actions provide developers with powerful tools to generate videos from images using a variety of customizable parameters. By leveraging these pre-built actions, you can streamline the video creation process and deliver captivating content with less effort.

Prerequisites

Before diving into the implementation of the Cognitive Actions, ensure that you have the following:

  • An API key for the Cognitive Actions platform. This key will authenticate your requests.
  • Familiarity with making HTTP requests and handling JSON data in your preferred programming language.

Authentication typically involves passing your API key in the request headers to authorize your access to the Cognitive Actions services.

Cognitive Actions Overview

Generate Video from Image

The Generate Video from Image action allows you to create a video by transforming a specified image, accompanied by a descriptive prompt that guides the style and content of the video. This action includes various parameters to fine-tune the output, such as resolution, frame count, and generation speed.

Input

The input for this action requires a structured JSON payload. Here’s a breakdown of the required and optional fields:

  • Required Fields:
    • prompt: A text description to guide the video generation (e.g., "a CYBERCAB drives away").
  • Optional Fields:
    • seed: An integer for random generation initialization (defaults to a random value).
    • image: URI of the image to use as the initial frame.
    • guideScale: A number determining the influence of the prompt (default is 5).
    • samplingSteps: Number of steps for video generation (default is 30).
    • numberOfFrames: Total frames to generate (default is 81).
    • generationSpeed: Speed setting for video generation (default is "Balanced").
    • videoResolution: Output video resolution (default is "480p").
    • clipLoraStrength: Intensity of LoRA applied to the CLIP model (default is 1).
    • undesiredContent: Elements/themes to avoid in the video.
    • videoAspectRatio: Aspect ratio of the video (default is "16:9").
    • modelLoraStrength: Strength of LoRA applied to the model (default is 1).
    • samplingShiftFactor: Affects shifting behavior during generation (default is 8).

Example Input:

{
  "prompt": "a CYBERCAB drives away",
  "guideScale": 5,
  "samplingSteps": 30,
  "numberOfFrames": 81,
  "clipLoraStrength": 1,
  "undesiredContent": "",
  "videoAspectRatio": "16:9",
  "modelLoraStrength": 1,
  "samplingShiftFactor": 8
}

Output

Upon successful execution, the action returns a URL link to the generated video. The output will typically resemble:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/172500b7-c5b8-467d-a87a-aa9a40294db6/abeddac7-c224-433c-8b79-cad4abc84075.mp4"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Generate Video from Image action using a hypothetical Cognitive Actions endpoint:

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 = "bdabea8a-7d2c-4367-a100-e62958c6af65"  # Action ID for Generate Video from Image

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "a CYBERCAB drives away",
    "guideScale": 5,
    "samplingSteps": 30,
    "numberOfFrames": 81,
    "clipLoraStrength": 1,
    "undesiredContent": "",
    "videoAspectRatio": "16:9",
    "modelLoraStrength": 1,
    "samplingShiftFactor": 8
}

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, replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The action_id variable corresponds to the Generate Video from Image action, and the payload contains the required input fields formatted as JSON. The endpoint URL and request structure are illustrative and may differ in your actual implementation.

Conclusion

The Generate Video from Image action within the fofr/wan-14b-cybercab Cognitive Actions offers a streamlined approach to creating engaging video content from images. By utilizing this action, developers can harness the power of AI to produce visually stunning results that captivate audiences. Experiment with the various parameters to customize your video outputs, and consider integrating this functionality into your applications for enhanced user experiences. Happy coding!