Skip to content

Video Config ​

The video config defines the dimensions and timing of your video. Understanding these properties helps you create properly sized and timed animations.

The Four Properties ​

PropertyDescriptionDefaultCLI Flag
fpsFrames per second30-f
durationInFramesTotal frame count90-d
widthVideo width in pixels1920-w
heightVideo height in pixels1080-h

FPS (Frames Per Second) ​

FPS determines smoothness and file size.

FPSUse CaseCharacter
24Cinematic, film-likeClassic, slightly dreamy
30Web standard, social mediaSmooth, universal
60High motion, gamingUltra-smooth, modern

Higher FPS = more frames to render = longer render time and larger files.

Duration in Frames ​

Duration is specified in frames, not seconds:

seconds = durationInFrames / fps
Desired Duration30fps60fps
3 seconds90 frames180 frames
5 seconds150 frames300 frames
10 seconds300 frames600 frames
30 seconds900 frames1800 frames
bash
# 10 second video at 30fps
npx pellicule -d 300 -f 30

Resolution (Width × Height) ​

Common video resolutions:

NameResolutionAspect RatioUse Case
720p1280×72016:9Web, fast renders
1080p1920×108016:9Standard HD
4K3840×216016:9YouTube, high quality
Square1080×10801:1Instagram feed
Vertical1080×19209:16TikTok, Reels, Stories
bash
# 4K video
npx pellicule -w 3840 -h 2160

# Instagram square
npx pellicule -w 1080 -h 1080

# TikTok vertical
npx pellicule -w 1080 -h 1920

Accessing Config in Components ​

Use useVideoConfig() to access these values:

vue
<script setup>
import { computed } from 'vue'
import { useFrame, useVideoConfig } from 'pellicule'

const frame = useFrame()
const { fps, durationInFrames, width, height } = useVideoConfig()

// Calculate progress (0 to 1)
const progress = computed(() => frame.value / durationInFrames)

// Time in seconds
const seconds = computed(() => (frame.value / fps).toFixed(2))

// Responsive font size (5% of width)
const fontSize = computed(() => width * 0.05)
</script>

Duration-Aware Animations ​

Make animations adapt to any video length:

js
const { durationInFrames } = useVideoConfig()

// Fade in during first 10% of video
const fadeInFrames = Math.floor(durationInFrames * 0.1)
const opacity = interpolate(frame.value, [0, fadeInFrames], [0, 1])

// Fade out during last 10%
const fadeOutStart = Math.floor(durationInFrames * 0.9)
const exitOpacity = interpolate(
  frame.value,
  [fadeOutStart, durationInFrames],
  [1, 0]
)

Responsive Design ​

Scale elements based on video dimensions:

js
const { width, height } = useVideoConfig()

// Font scales with video width
const titleSize = width * 0.08 // 8% of width

// Padding scales with smaller dimension
const padding = Math.min(width, height) * 0.05

// Center position
const centerX = width / 2
const centerY = height / 2
  • useVideoConfig — The composable for accessing config
  • CLI — Command-line options for setting config

All open source projects are released under the MIT License.