Transform Your Videos into Art with Van Gogh-Style Cognitive Actions

22 Apr 2025
Transform Your Videos into Art with Van Gogh-Style Cognitive Actions

In the realm of creative technology, the ability to transform digital media into artistic expressions can enhance user engagement and provide unique experiences. The shridharathi/van-gogh-vid API offers a powerful Cognitive Action that allows developers to convert videos into stunning artworks inspired by the iconic style of Vincent van Gogh. By leveraging this API, developers can enrich their applications with artistic video content, opening doors to innovative storytelling and enhanced aesthetic quality.

Prerequisites

Before you dive into integrating the Cognitive Action, ensure you have the following:

  • API Key: You will need an API key to access the Cognitive Actions platform. This key should be included in the request headers for authentication.
  • Basic Knowledge of JSON: Understanding how to structure JSON will be essential for constructing your input payload.

Authentication is typically handled by passing the API key in the request headers, ensuring secure access to the action.

Cognitive Actions Overview

Transform Video to Van Gogh Style

The Transform Video to Van Gogh Style action is designed to convert your videos into mesmerizing artistic pieces, inspired by Van Gogh's iconic painting techniques. This action enhances the aesthetic quality of video content, allowing for creative expression through technology.

  • Category: Video Processing

Input

The input for this action is defined by a schema that includes several parameters:

  • prompt (required): A text-based input guiding the theme of the generated video (e.g., "GOGH style, painting of a man walking in a field with trees and sunlight").
  • seed (optional): An integer to specify a random seed for repeatability.
  • image (optional): A URI to an image that will be used as the initial frame.
  • guideScale (optional): A number (default: 5) indicating how much the prompt influences the generation.
  • clipStrength (optional): A number (default: 1) to define the influence level of LoRA on the CLIP model.
  • customWeights (optional): Custom LoRA weights for the model.
  • modelStrength (optional): A number (default: 1) adjusting the strength of modifications.
  • numberOfFrames (optional): An integer (default: 81) that specifies the total number of frames (choices: 17, 33, 49, 65, 81).
  • generationSteps (optional): An integer (default: 30) indicating how many steps to use in generation.
  • videoResolution (optional): The resolution of the video (default: "480p").
  • accelerationMode (optional): Mode for generation speed (default: "Balanced").
  • videoAspectRatio (optional): Aspect ratio options (default: "16:9").
  • sampleShiftFactor (optional): A number (default: 8) to modify generation characteristics.
  • undesiredElements (optional): Specify elements to exclude from the output.

Example Input

Here’s an example of how the input JSON might look:

{
  "prompt": "GOGH style, painting of a man walking in a field with trees and sunlight",
  "guideScale": 5,
  "clipStrength": 1,
  "modelStrength": 1,
  "numberOfFrames": 81,
  "generationSteps": 30,
  "videoResolution": "480p",
  "accelerationMode": "Balanced",
  "videoAspectRatio": "16:9",
  "sampleShiftFactor": 8,
  "undesiredElements": ""
}

Output

The output of this action is a URL to the generated video, which will appear as follows:

[
  "https://assets.cognitiveactions.com/invocations/6fe37efc-3595-4984-b81a-5a84169eb57d/8c81b8eb-6145-4573-8baa-698a7e6bbfec.mp4"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet that demonstrates how you might call this action using a hypothetical Cognitive Actions execution 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 = "e392b21f-1f99-4703-bf18-913cb14eaf2f"  # Action ID for Transform Video to Van Gogh Style

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "GOGH style, painting of a man walking in a field with trees and sunlight",
    "guideScale": 5,
    "clipStrength": 1,
    "modelStrength": 1,
    "numberOfFrames": 81,
    "generationSteps": 30,
    "videoResolution": "480p",
    "accelerationMode": "Balanced",
    "videoAspectRatio": "16:9",
    "sampleShiftFactor": 8,
    "undesiredElements": ""
}

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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload is structured according to the action's requirements, and the response will contain the URL to the generated video.

Conclusion

The Transform Video to Van Gogh Style action offers an exciting opportunity for developers to enhance their applications with artistic video transformations. By integrating this Cognitive Action, you can provide users with a unique and creative video experience that stands out. Consider experimenting with various input parameters to achieve different artistic effects and explore potential use cases in art, education, and entertainment. Happy coding!