Primitives.org.ai

video

Generate videos from text descriptions

Generate videos from text descriptions.

Import

import { video } from 'ai-functions'

Syntax

video`description`
video`description`(options)
video(description: string, options?: VideoOptions)

Examples

// Tagged template
const teaser = await video`product demo for ${productName}`
const explainer = await video`explain ${concept} with animations`

// With options
const ad = await video('promotional video for SaaS product', {
  duration: 30,
  aspect: '16:9',
  style: 'motion graphics',
})

// With detailed requirements
const tutorial = await video`coding tutorial${{
  topic: 'Building REST APIs',
  duration: 60,
  style: 'screen recording with voiceover',
  chapters: ['Setup', 'Routes', 'Testing'],
}}`

Options

OptionTypeDescription
durationnumberLength in seconds
aspect'16:9' | '9:16' | '1:1'Aspect ratio
stylestringVisual style
formatstringOutput format

Use Cases

// Social media
const teaser = await video`15 second teaser for ${product}${{
  aspect: '9:16',  // Vertical for TikTok/Reels
}}`

// Marketing
const ad = await video`30 second ad for ${campaign}`
const demo = await video`product demo showing ${features}`

// Content
const explainer = await video`explain ${concept} simply`
const intro = await video`channel intro for ${brand}`

Return Type

Returns a Buffer containing the video data:

const videoBuffer = await video`product demo`
await fs.writeFile('demo.mp4', videoBuffer)
Was this page helpful?

On this page