Create Stunning Album Videos with the myaiteam2/album-video-maker Cognitive Actions

24 Apr 2025
Create Stunning Album Videos with the myaiteam2/album-video-maker Cognitive Actions

In today's digital landscape, creating engaging multimedia content has become essential for personal expression and marketing. The myaiteam2/album-video-maker API simplifies this process by providing Cognitive Actions that enable developers to generate videos by combining audio and image inputs seamlessly. In this article, we will explore the capabilities of the "Create Album Video" action, which allows you to create visually appealing videos that incorporate your chosen audio tracks and album cover images.

Prerequisites

Before diving into the integration, ensure you have the following prerequisites:

  • An API key for the Cognitive Actions platform.
  • Basic knowledge of JSON structure and HTTP requests.
  • Familiarity with Python and the requests library for making API calls.

Authentication typically involves passing your API key in the request headers, allowing you to securely access the Cognitive Actions services.

Cognitive Actions Overview

Create Album Video

The Create Album Video action generates a video by combining specified audio and image inputs while allowing you to define specific start and end times for the audio segment. This action falls under the video-generation category and is ideal for creating music videos, promotional content, or personal albums.

Input

The input for this action requires a JSON object that must include the following fields:

  • audio (string, required): URI pointing to an audio file in MP3 format.
  • image (string, required): URI of the album cover image.
  • startTime (string, optional): Start time of the song in mm:ss format (defaults to "00:00").
  • endTime (string, optional): End time of the song in mm:ss format (defaults to "03:30").

Here’s a practical example of the input JSON payload:

{
  "audio": "https://replicate.delivery/pbxt/KgvofyErPcxpWCe1TiMw7efxU02d9O4YcaH5pmKOaztJb9OW/Truth%20of%20Addiction.mp3",
  "image": "https://replicate.delivery/pbxt/KgvogSy3EZNOYxzbF5T2BOLRIKkWLHYEO4RWWuTTboEKn8g9/MY%20ADDICTION.png",
  "endTime": "00:59"
}

Output

Upon successful execution, the action returns a URL pointing to the generated video file. For example:

https://assets.cognitiveactions.com/invocations/2d371c77-a0d5-420d-a339-87f9b0ec6d24/b08c19d2-cfb0-404c-ba66-b90597e30033.mp4

This URL can be used to access and share the newly created video.

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to call the Create Album Video 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 = "dd995017-744c-40f9-8ab1-d83fad722326"  # Action ID for Create Album Video

# Construct the input payload based on the action's requirements
payload = {
    "audio": "https://replicate.delivery/pbxt/KgvofyErPcxpWCe1TiMw7efxU02d9O4YcaH5pmKOaztJb9OW/Truth%20of%20Addiction.mp3",
    "image": "https://replicate.delivery/pbxt/KgvogSy3EZNOYxzbF5T2BOLRIKkWLHYEO4RWWuTTboEKn8g9/MY%20ADDICTION.png",
    "endTime": "00:59"
}

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, and the endpoint URL with the correct one for your use case. The action ID and input payload are structured according to the requirements of the Create Album Video action.

Conclusion

The myaiteam2/album-video-maker Cognitive Actions provide a powerful and straightforward way to create album videos by merging audio and images. By integrating these actions into your applications, you can enhance user engagement and broaden your content creation capabilities. Consider experimenting with different audio and image combinations, and don't hesitate to explore additional use cases for your projects!