veo-3-1
v1772075.106.941
Published
Professional integration for https://supermaker.ai/video/veo-3-1/
Readme
veo-3-1
A JavaScript utility for simplifying common video processing tasks related to the Supermaker.ai Veo-3-1 platform. This package provides convenient functions for interacting with video data and streamlining your workflow.
Installation
bash npm install veo-3-1
Usage Examples
Here are a few examples demonstrating how to use the veo-3-1 package in your JavaScript projects:
1. Basic Video Duration Retrieval: javascript const { getVideoDuration } = require('veo-3-1');
async function main() {
try {
const videoUrl = 'https://example.com/video.mp4'; // Replace with your video URL
const duration = await getVideoDuration(videoUrl);
console.log(Video duration: ${duration} seconds);
} catch (error) {
console.error('Error getting video duration:', error);
}
}
main();
2. Thumbnail Generation (Server-Side): javascript const { generateThumbnail } = require('veo-3-1'); const fs = require('fs');
async function generateAndSaveThumbnail() { try { const videoUrl = 'https://example.com/video.mp4'; // Replace with your video URL const outputPath = 'thumbnail.jpg'; // Replace with your desired output path const thumbnailData = await generateThumbnail(videoUrl, { time: '00:00:05' }); // Generate thumbnail at 5 seconds
fs.writeFileSync(outputPath, thumbnailData);
console.log(`Thumbnail saved to ${outputPath}`);} catch (error) { console.error('Error generating thumbnail:', error); } }
generateAndSaveThumbnail();
3. Checking Video Format Compatibility: javascript const { isSupportedFormat } = require('veo-3-1');
function checkFormat() { const videoUrl = 'https://example.com/video.webm'; // Replace with your video URL const supported = isSupportedFormat(videoUrl);
if (supported) { console.log('Video format is supported.'); } else { console.log('Video format is not supported.'); } }
checkFormat();
4. Extracting Audio from Video (Server-Side - requires ffmpeg): javascript const { extractAudio } = require('veo-3-1');
async function extractAndSaveAudio() { try { const videoUrl = 'https://example.com/video.mp4'; // Replace with your video URL const outputPath = 'audio.mp3'; // Replace with your desired output path await extractAudio(videoUrl, outputPath);
console.log(`Audio extracted and saved to ${outputPath}`);} catch (error) { console.error('Error extracting audio:', error); } }
extractAndSaveAudio();
5. Getting Video Metadata: javascript const { getVideoMetadata } = require('veo-3-1');
async function displayMetadata() { try { const videoUrl = 'https://example.com/video.mp4'; // Replace with your video URL const metadata = await getVideoMetadata(videoUrl); console.log("Video Metadata:", metadata); } catch (error) { console.error("Error getting video metadata:", error); } }
displayMetadata();
API Summary
getVideoDuration(videoUrl: string): Promise<number>: Retrieves the duration of a video from a given URL. Returns a Promise that resolves with the duration in seconds.generateThumbnail(videoUrl: string, options?: { time: string }): Promise<Buffer>: Generates a thumbnail image from a video at a specified time. Returns a Promise that resolves with a Buffer containing the thumbnail image data (JPEG format). Theoptionsobject allows specifying the time (e.g., '00:00:10' for 10 seconds).isSupportedFormat(videoUrl: string): boolean: Checks if the video format at the given URL is supported. Returnstrueif supported,falseotherwise.extractAudio(videoUrl: string, outputPath: string): Promise<void>: Extracts the audio from a video and saves it to a specified file path. Requires ffmpeg to be installed on the system. Returns a Promise that resolves when the extraction is complete.getVideoMetadata(videoUrl: string): Promise<object>: Retrieves metadata about the video file, such as dimensions, codecs, and file size. Returns a Promise that resolves with an object containing the metadata.
License
MIT
This package is part of the veo-3-1 ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/veo-3-1/
