Create Stunning Videos with the Hunyuan-Dune Cognitive Actions

The Hunyuan-Dune API offers powerful tools for video generation, enabling developers to create unique and visually striking videos inspired by the artistic style of the acclaimed film Dune. With the Generate Dune-Style Video action, you can leverage the Hunyuan-Video model to synthesize videos based on custom prompts while adjusting various parameters for tailored outputs. This article will walk you through the capabilities of this action, including how to structure your requests and integrate it into your applications.
Prerequisites
Before you start using the Hunyuan-Dune Cognitive Action, ensure you have the following:
- An API key for the Cognitive Actions platform.
- Familiarity with JSON format, as the input and output will utilize JSON structures.
- Basic understanding of making HTTP requests in your programming language of choice (we'll use Python for our examples).
To authenticate your requests, you will typically pass your API key in the headers of your HTTP requests.
Cognitive Actions Overview
Generate Dune-Style Video
The Generate Dune-Style Video action allows you to create videos with a distinctive artistic style, drawing inspiration from the visual aesthetics of the 2021 film Dune. This action supports custom prompts while also allowing you to modify video parameters such as resolution, frame rate, and more.
Input
The input for this action is structured as a JSON object, which includes several customizable fields:
{
"seed": 12345,
"steps": 50,
"width": 640,
"height": 360,
"prompt": "A video in the style of DN...",
"frameRate": 16,
"frameCount": 66,
"loraStrength": 1,
"guidanceScale": 6
}
- seed (integer): Optional. An initial seed for generating consistent results. If not specified, a random seed is used.
- steps (integer): Optional. Specifies the number of diffusion steps for video generation, default is 50.
- width (integer): Optional. Width of the generated video in pixels, default is 640 (range: 64-1536).
- height (integer): Optional. Height of the generated video in pixels, default is 360 (range: 64-1024).
- prompt (string): Required. Describes the video scene you wish to create.
- frameRate (integer): Optional. Frame rate of the video in fps, default is 16 (range: 1-60).
- frameCount (integer): Optional. Total number of frames in the video, default is 33 (range: 1-1440).
- loraStrength (number): Optional. Adjusts the influence of the LoRA model, default is 1 (range: -10 to 10).
- guidanceScale (number): Optional. Balances between textual prompts and model guidance, default is 6 (range: 0-30).
Output
Upon successful execution, this action returns a URL to the generated video:
https://assets.cognitiveactions.com/invocations/e7228d65-5a59-47e8-a2d5-297571b8e10e/f8ad03cb-a2fb-4c66-af3d-4371f36c9282.mp4
This URL links directly to the synthesized video, which can be used for playback or further processing.
Conceptual Usage Example (Python)
Here's a conceptual example of how you might call the Generate Dune-Style Video 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 = "79446978-0410-47f0-910a-8ad79873e0fa" # Action ID for Generate Dune-Style Video
# Construct the input payload based on the action's requirements
payload = {
"seed": 12345,
"steps": 50,
"width": 640,
"height": 360,
"prompt": "A video in the style of DN...",
"frameRate": 16,
"frameCount": 66,
"loraStrength": 1,
"guidanceScale": 6
}
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 dictionary contains the input parameters that align with the action's requirements. The endpoint URL and request structure are illustrative and should be adapted based on your implementation.
Conclusion
The Hunyuan-Dune Cognitive Action provides a robust way to generate visually captivating videos using customizable inputs. By leveraging the capabilities of the Generate Dune-Style Video action, developers can create unique video content that reflects their creative vision. Explore the potential applications of this action in your projects, and start synthesizing stunning videos today!