Generate High-Quality Videos with the Zeroscope V2 XL Cognitive Actions

24 Apr 2025
Generate High-Quality Videos with the Zeroscope V2 XL Cognitive Actions

The anotherjesse/zeroscope-v2-xl API offers developers a powerful tool for generating high-quality videos through a streamlined set of Cognitive Actions. Utilizing cutting-edge vid2vid technology, this API can transform your video inputs into smooth, visually stunning outputs. With its user-friendly design, developers can leverage these pre-built actions to enhance multimedia applications easily.

Prerequisites

Before you get started with the Zeroscope V2 XL Cognitive Actions, ensure you have the following:

  • API Key: You will need an API key to access the Cognitive Actions platform. This key typically must be passed in the request headers for authentication.
  • Basic Understanding of JSON: Familiarity with JSON will help you structure your input and understand the output effectively.

Authentication generally involves adding your API key to the request headers. Here’s a conceptual representation:

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

Cognitive Actions Overview

Generate High-Quality Video with Zeroscope V2 XL

The Generate High-Quality Video with Zeroscope V2 XL action utilizes the advanced Modelscope-based Zeroscope V2 XL model to produce high-quality 16:9 videos. Trained on a vast dataset, it excels in generating upscale videos using video inputs.

  • Category: Video Generation

Input

The action requires a structured input schema. Here are the key fields:

  • fps: (integer) Frames per second for the output video. Default is 8.
  • seed: (integer) Random seed for reproducibility. Leave null for a random seed.
  • model: (string) Model selection for video generation (options: "xl", "576w", "potat1", "animov-512x"). Default is "xl".
  • width: (integer) Width of the output video in pixels (minimum 256, default 576).
  • height: (integer) Height of the output video in pixels (minimum 256, default 320).
  • prompt: (string) Input prompt to guide video generation. Example: "An astronaut riding a horse".
  • batchSize: (integer) Number of output videos to generate in a single batch. Minimum value is 1.
  • initialVideo: (string) URL of the initial video (optional).
  • guidanceScale: (number) Scaling factor for guidance (default 7.5, range 1-100).
  • initialWeight: (number) Influence strength of the initial video (default 0.5).
  • negativePrompt: (string) Terms to avoid in video generation (optional).
  • numberOfFrames: (integer) Total number of frames in the output video. Default is 24.
  • removeWatermark: (boolean) Flag to remove watermark (default false).
  • numberOfInferenceSteps: (integer) Number of denoising steps (default 50, range 1-500).

Example Input:

{
  "fps": 24,
  "width": 1024,
  "height": 576,
  "prompt": "Clown fish swimming in a coral reef, beautiful, 8k, perfect, award winning, national geographic",
  "guidanceScale": 17.5,
  "negativePrompt": "very blue, dust, noisy, washed out, ugly, distorted, broken",
  "numberOfFrames": 24,
  "numberOfInferenceSteps": 50
}

Output

The action typically returns a URL to the generated video. Here's a sample output:

[
  "https://assets.cognitiveactions.com/invocations/8ba99af7-2fec-4ed6-8235-9aa85729bcb2/eb9467ba-ba67-44f2-8676-57590ea91a54.mp4"
]

Conceptual Usage Example (Python)

Here’s how you might integrate the action into your application 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 = "7fa03f30-ded8-48ca-a382-9d8a7e3c0df6" # Action ID for Generate High-Quality Video

# Construct the input payload based on the action's requirements
payload = {
    "fps": 24,
    "width": 1024,
    "height": 576,
    "prompt": "Clown fish swimming in a coral reef, beautiful, 8k, perfect, award winning, national geographic",
    "guidanceScale": 17.5,
    "negativePrompt": "very blue, dust, noisy, washed out, ugly, distorted, broken",
    "numberOfFrames": 24,
    "numberOfInferenceSteps": 50
}

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 the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The structured input payload is tailored to meet the requirements of the action.

Conclusion

The Zeroscope V2 XL Cognitive Action provides a robust solution for developers looking to generate high-quality videos effortlessly. By leveraging the capabilities of this API, you can enhance your applications with rich, engaging multimedia content. Explore the possibilities and integrate the Zeroscope V2 XL actions into your projects today!