# AI Text to Video Generator (`akash9078/ai-text-to-video-generator`) Actor

Transform text prompts into professional AI-generated explainer videos instantly. High-quality text-to-video automation powered by NVIDIA AI and Remotion.

- **URL**: https://apify.com/akash9078/ai-text-to-video-generator.md
- **Developed by:** [Akash Kumar Naik](https://apify.com/akash9078) (community)
- **Categories:** AI, Automation, Videos
- **Stats:** 3 total users, 2 monthly users, 75.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.00005 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 🎬 NVIDIA NIM + Remotion Video Generator

Transform your ideas into stunning AI-powered videos with just a text prompt. This Actor combines the power of NVIDIA's NIM LLM for intelligent script generation with Remotion's professional video rendering capabilities.

### What it does

🎯 **Generate AI-powered videos from text prompts**

This Actor creates professional explainer videos by:
- **Understanding your topic**: Uses NVIDIA's NIM LLM to generate compelling video scripts
- **Creating structured content**: Produces titles, subtitles, slides with bullet points, and call-to-action text
- **Rendering high-quality videos**: Uses Remotion to render videos in multiple resolutions (480p, 720p, 1080p)
- **Delivering instantly**: Uploads videos to Apify Key-Value Store with public download URLs

### How to use

#### Input

```json
{
  "prompt": "The future of AI and how it's changing our world",
  "quality": "medium",
  "outputFileName": "ai-video",
  "skipRender": false
}
````

**Input fields:**

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `prompt` | string | ✅ Yes | - | The topic or idea for your video (max 1000 chars) |
| `quality` | string | No | `medium` | Video quality: `low` (480p), `medium` (720p), or `high` (1080p) |
| `outputFileName` | string | No | `ai-video` | Name for the output MP4 file (without extension) |
| `skipRender` | boolean | No | `false` | Set to `true` to only generate script without rendering |

#### Output

The Actor outputs structured data to the default dataset:

```json
{
  "prompt": "The future of AI and how it's changing our world",
  "title": "The AI Revolution",
  "subtitle": "Transforming Our World Through Intelligence",
  "slides": [
    {
      "heading": "What is AI?",
      "points": [
        "Artificial Intelligence simulates human thinking",
        "Machine learning enables pattern recognition",
        "Neural networks process complex data"
      ]
    },
    {
      "heading": "Impact on Society",
      "points": [
        "Automation transforms industries",
        "Healthcare becomes more precise",
        "Education becomes personalized"
      ]
    },
    {
      "heading": "The Future",
      "points": [
        "AI assistants become ubiquitous",
        "Creative tasks are augmented",
        "Ethical frameworks evolve"
      ]
    }
  ],
  "cta": "Embrace the future today",
  "slideCount": 3,
  "videoUrl": "https://api.apify.com/v2/key-value-stores/xxx/records/ai-video",
  "scriptKey": "video-script",
  "quality": "medium",
  "duration": 540,
  "durationSeconds": 18,
  "renderedAt": "2024-01-15T10:30:00.000Z"
}
```

**Output fields:**

| Field | Type | Description |
|-------|------|-------------|
| `prompt` | string | Original user prompt |
| `title` | string | Generated video title |
| `subtitle` | string | Generated subtitle |
| `slides` | array | Array of slide objects with heading and points |
| `cta` | string | Call-to-action text |
| `slideCount` | integer | Number of slides in video |
| `videoUrl` | string | Public URL to download the MP4 video |
| `scriptKey` | string | Key in Key-Value Store where script is saved |
| `quality` | string | Quality setting used |
| `duration` | integer | Video duration in frames @ 30fps |
| `durationSeconds` | integer | Video duration in seconds |
| `renderedAt` | string | ISO timestamp |

#### Key-Value Store Outputs

The Actor saves two items to the Key-Value Store:

1. **`video-script`** - The complete generated script (JSON)
2. **`{outputFileName}`** - The rendered MP4 video file

Access via API:

```bash
curl "https://api.apify.com/v2/key-value-stores/{storeId}/records/{fileName}" \
  -H "Authorization: Bearer {token}"
```

### 💰 Pricing

This Actor uses **Pay Per Event** pricing:

| Event | Price | Description |
|-------|-------|-------------|
| `apify-actor-start` | $0.00005 | Actor startup (free 5s compute provided by Apify) |
| `video-script-generated` | $0.05 | AI script generation with NVIDIA NIM LLM |
| `video-rendered` | $0.15 | Complete video rendering (up to 3 slides) |
| `slide-rendered` | $0.03 | Each additional slide beyond 3 |

**Example pricing:**

- 1 video with 3 slides = **$0.20**
- 1 video with 5 slides = **$0.26** ($0.20 + 2×$0.03)
- Script only (skipRender=true) = **$0.05**

### ⚙️ Setup Requirements

#### Environment Variables

Before running this Actor, set up:

| Variable | Required | Description |
|----------|----------|-------------|
| `NVIDIA_API_KEY` | ✅ Yes | Your NVIDIA NIM API key from [NVIDIA NIM](https://build.nvidia.com/) |

#### Getting NVIDIA API Key

1. Visit [build.nvidia.com](https://build.nvidia.com/)
2. Create an account or sign in
3. Navigate to the API section
4. Generate your API key
5. Copy the key to your Actor's environment variables

### 🚀 Use Cases

#### Marketing & Sales

- Create product explainer videos
- Generate social media content
- Build video ads from product descriptions
- Produce pitch deck videos

#### Education & Training

- Convert lessons into engaging videos
- Create tutorial content
- Generate course previews
- Build training materials

#### Content Creation

- Transform blog posts into videos
- Create YouTube content
- Generate podcast visualizations
- Produce short-form social content

#### Business Communication

- Make internal announcements
- Create company updates
- Generate investor presentations
- Build brand storytelling videos

### 📊 Performance

| Quality | Resolution | Avg. Render Time\* | File Size |
|---------|------------|-----------------|-----------|
| Low | 854×480 | ~30s | ~5 MB |
| Medium | 1280×720 | ~60s | ~15 MB |
| High | 1920×1080 | ~120s | ~40 MB |

\*Based on 3-slide video on 4GB memory

**Resource Requirements:**

- Minimum memory: 2GB
- Recommended memory: 4GB
- Maximum memory: 8GB
- Timeout: 10 minutes

### 🔧 Technical Details

#### How it works

1. **Input Processing**: Validates user input and sanitizes the prompt
2. **Script Generation**: Sends prompt to NVIDIA NIM (gpt-oss-20b model) with structured instructions
3. **Data Validation**: Validates and sanitizes the generated JSON script
4. **Video Rendering**: Bundles React/Remotion components and renders to MP4
5. **Output Delivery**: Uploads video to Key-Value Store and pushes metadata to Dataset

#### Error Handling

The Actor includes comprehensive error handling:

- Input validation with clear error messages
- NVIDIA API retry logic (3 attempts with exponential backoff)
- JSON parsing with multiple fallback strategies
- Video data validation before rendering
- Detailed error logging to Key-Value Store

#### Retry Behavior

- **NVIDIA API**: 3 retries with exponential backoff (1s, 2s, 4s)
- **Validation**: Automatic truncation for text exceeding limits
- **Rendering**: Timeout protection with cleanup

### 💡 Tips & Best Practices

#### Prompt Engineering

**Good prompts:**

- "The benefits of meditation for mental health"
- "How blockchain technology is revolutionizing finance"
- "10 tips for effective remote work"
- "The history and future of electric vehicles"

**Tips:**

- Be specific about the topic
- Include the target audience if relevant
- Mention key points you want covered
- Keep prompts under 1000 characters

#### Quality Selection

- **Low (480p)**: Quick previews, social stories, testing
- **Medium (720p)**: Standard presentations, social media, websites
- **High (1080p)**: Professional content, presentations, YouTube

#### Memory Optimization

- Use 2GB for script generation only (skipRender=true)
- Use 4GB for standard video rendering (3-5 slides)
- Use 8GB for high-quality rendering with many slides

#### Cost Optimization

1. Test with `skipRender=true` first to validate scripts
2. Use `low` quality for development/testing
3. Limit slides by making prompts more focused
4. Monitor the `charging_log` dataset for usage tracking

### 🐛 Troubleshooting

#### Common Issues

**"NVIDIA\_API\_KEY is required"**

- Check that you've set the `NVIDIA_API_KEY` environment variable
- Verify the key is valid at [build.nvidia.com](https://build.nvidia.com/)

**"Video rendering failed"**

- Increase memory allocation (4GB recommended)
- Try `low` quality setting first
- Check that Remotion components are not throwing errors

**"Failed to parse LLM response"**

- The LLM may have returned non-JSON output
- Try a simpler, more specific prompt
- Check error details in Key-Value Store (`error-details`)

**"Browser/chromium not found"**

- The Actor includes Chrome in the Docker image
- This error shouldn't occur in production
- For local testing, install Chrome or set `CHROME_BIN`

#### Getting Help

If you encounter issues:

1. Check the **Log** tab for detailed error messages
2. Look up `error-details` in the Key-Value Store
3. Review the **Dataset** for partial results
4. Contact support with your Run ID

### 📚 Related Actors

- **Text to Speech** - Add AI-generated voiceovers to your videos
- **Image to Video** - Convert images into video content
- **Video Transcription** - Extract text from videos

### 🔗 Links

- [NVIDIA NIM Documentation](https://docs.nvidia.com/nim/)
- [Remotion Documentation](https://www.remotion.dev/)
- [Apify Actors Documentation](https://docs.apify.com/actors)

***

**Built with** ❤️ using Apify, NVIDIA NIM, and Remotion

# Actor input Schema

## `prompt` (type: `string`):

The topic or idea for the video content. Be specific for best results.

## `voice` (type: `string`):

AI voice for narration. Choose the voice that best fits your content.

## Actor input object example

```json
{
  "prompt": "The benefits of meditation for mental health and productivity",
  "voice": "paul-neutral"
}
```

# Actor output Schema

## `videos` (type: `string`):

MP4 video files generated from your prompts

## `scripts` (type: `string`):

JSON scripts generated for the videos

## `results` (type: `string`):

Structured metadata about generated videos

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "prompt": "The benefits of meditation for mental health and productivity",
    "voice": "paul-neutral"
};

// Run the Actor and wait for it to finish
const run = await client.actor("akash9078/ai-text-to-video-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "prompt": "The benefits of meditation for mental health and productivity",
    "voice": "paul-neutral",
}

# Run the Actor and wait for it to finish
run = client.actor("akash9078/ai-text-to-video-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "prompt": "The benefits of meditation for mental health and productivity",
  "voice": "paul-neutral"
}' |
apify call akash9078/ai-text-to-video-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=akash9078/ai-text-to-video-generator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Text to Video Generator",
        "description": "Transform text prompts into professional AI-generated explainer videos instantly. High-quality text-to-video automation powered by NVIDIA AI and Remotion.",
        "version": "1.0",
        "x-build-id": "5jaxleeYabRDwEelq"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/akash9078~ai-text-to-video-generator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-akash9078-ai-text-to-video-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/akash9078~ai-text-to-video-generator/runs": {
            "post": {
                "operationId": "runs-sync-akash9078-ai-text-to-video-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/akash9078~ai-text-to-video-generator/run-sync": {
            "post": {
                "operationId": "run-sync-akash9078-ai-text-to-video-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "prompt"
                ],
                "properties": {
                    "prompt": {
                        "title": "Video Prompt",
                        "type": "string",
                        "description": "The topic or idea for the video content. Be specific for best results."
                    },
                    "voice": {
                        "title": "Voice",
                        "enum": [
                            "paul-neutral",
                            "paul-happy",
                            "paul-confident",
                            "paul-cheerful",
                            "oliver-neutral"
                        ],
                        "type": "string",
                        "description": "AI voice for narration. Choose the voice that best fits your content.",
                        "default": "paul-neutral"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
