bigfoot-video-generator
v1767666.962.997
Published
Professional integration for https://supermaker.ai/video/bigfoot-video-generator/
Maintainers
Readme
bigfoot-video-generator
A Node.js library for programmatically generating videos using templates and data. Streamline your video creation workflow with this powerful utility.
Installation
bash npm install bigfoot-video-generator
Usage Examples
Here are a few examples demonstrating how to use bigfoot-video-generator in your projects:
1. Generating a Video from a JSON Data Source: javascript const { VideoGenerator } = require('bigfoot-video-generator');
async function generateVideoFromJSON(templatePath, jsonData, outputPath) { const generator = new VideoGenerator({ templatePath });
try {
await generator.render(jsonData, outputPath);
console.log(Video generated successfully at: ${outputPath});
} catch (error) {
console.error('Error generating video:', error);
}
}
// Example usage: const templatePath = './path/to/your/video-template.aep'; // Path to your After Effects template const jsonData = { title: 'My Awesome Video', description: 'A dynamically generated video using bigfoot-video-generator.', author: 'SuperMaker AI' }; const outputPath = './output/my-generated-video.mp4';
generateVideoFromJSON(templatePath, jsonData, outputPath);
2. Creating a Batch of Videos with Different Data: javascript const { VideoGenerator } = require('bigfoot-video-generator');
async function generateBatchVideos(templatePath, dataArray, outputDir) { const generator = new VideoGenerator({ templatePath });
for (let i = 0; i < dataArray.length; i++) {
const data = dataArray[i];
const outputPath = ${outputDir}/video_${i + 1}.mp4;
try {
await generator.render(data, outputPath);
console.log(`Video ${i + 1} generated successfully at: ${outputPath}`);
} catch (error) {
console.error(`Error generating video ${i + 1}:`, error);
}} }
// Example Usage: const templatePath = './path/to/your/video-template.aep'; const dataArray = [ { title: 'Video 1', description: 'First video', author: 'SuperMaker AI' }, { title: 'Video 2', description: 'Second video', author: 'SuperMaker AI' }, { title: 'Video 3', description: 'Third video', author: 'SuperMaker AI' } ]; const outputDir = './output/batch/';
generateBatchVideos(templatePath, dataArray, outputDir);
3. Using Asynchronous Data Fetching: javascript const { VideoGenerator } = require('bigfoot-video-generator');
async function generateVideoWithRemoteData(templatePath, apiUrl, outputPath) { const generator = new VideoGenerator({ templatePath });
try { const response = await fetch(apiUrl); const jsonData = await response.json();
await generator.render(jsonData, outputPath);
console.log(`Video generated successfully at: ${outputPath}`);} catch (error) { console.error('Error generating video:', error); } }
// Example Usage: const templatePath = './path/to/your/video-template.aep'; const apiUrl = 'https://api.example.com/video-data'; // Replace with your API endpoint const outputPath = './output/remote-data-video.mp4';
generateVideoWithRemoteData(templatePath, apiUrl, outputPath);
4. Handling Template Rendering Errors: javascript const { VideoGenerator } = require('bigfoot-video-generator');
async function generateVideoWithErrorHandling(templatePath, jsonData, outputPath) { const generator = new VideoGenerator({ templatePath });
try {
await generator.render(jsonData, outputPath);
console.log(Video generated successfully at: ${outputPath});
} catch (error) {
console.error('Video generation failed. Inspect the error details:', error);
// Implement custom error handling logic here (e.g., logging, retry, fallback).
}
}
// Example usage: const templatePath = './path/to/your/video-template.aep'; const jsonData = { // Incorrect data that might cause an error in the template wrongProperty: 'This will likely cause an error' }; const outputPath = './output/error-handling-video.mp4';
generateVideoWithErrorHandling(templatePath, jsonData, outputPath);
API Summary
VideoGenerator(options): Constructor for creating a newVideoGeneratorinstance.optionsis an object containing:templatePath(string, required): The path to the After Effects template file (.aep).
VideoGenerator.render(data, outputPath): Renders the video template with the provided data and saves the output to the specified path.data(object, required): The data to be used for rendering the template. The structure of this object must match the expected input of your After Effects template.outputPath(string, required): The path where the generated video file will be saved.
License
MIT
This package is part of the bigfoot-video-generator ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/bigfoot-video-generator/
