New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@polotno/video-export

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polotno/video-export

Convert Polotno store into video file

latest
npmnpm
Version
0.0.11
Version published
Weekly downloads
163
-10.93%
Maintainers
2
Weekly downloads
 
Created
Source

Polotno to Video

Convert Polotno store into video files using browser-based video encoding.

Installation

npm install @polotno/video-export

Features

  • ✅ Browser-based video encoding (no server required)
  • ✅ Support for animations and timeline
  • ✅ Multiple pages with durations
  • Audio support with multiple tracks, delays, and volume control
  • ✅ Customizable FPS and pixel ratio
  • ✅ Progress tracking
  • ✅ MP4 output format

Usage

import { storeToVideo } from '@polotno/video-export';
import { createStore } from 'polotno/model/store';

const store = createStore({ key: 'YOUR_KEY' });

// Export video
const videoBlob = await storeToVideo({
  store,
  fps: 30, // Frames per second (default: 30)
  pixelRatio: 2, // Pixel ratio for quality (default: 1)
  onProgress: (progress, frameTime) => {
    console.log(`Progress: ${Math.round(progress * 100)}%`);
    console.log(`Frame render time: ${frameTime}ms`);
  },
  // Optional: cancel the export
  // signal: new AbortController().signal,
});

// Download the video
const url = URL.createObjectURL(videoBlob);
const link = document.createElement('a');
link.href = url;
link.download = 'video.mp4';
link.click();

Cancel / Abort

You can cancel an in-progress export with an AbortController:

const controller = new AbortController();

const promise = storeToVideo({
  store,
  signal: controller.signal,
});

// Later...
controller.abort();

// `storeToVideo` will reject with an AbortError
await promise;

How it works

  • Timeline Calculation: The function calculates the total duration from all pages and their durations
  • Frame Rendering: For each frame at the specified FPS:
    • Updates the store's current time
    • Selects the appropriate page
    • Renders the page to a data URL using store.toDataURL()
    • Draws the image to a canvas
  • Video Encoding: Uses Media Bunny to encode frames into MP4
  • Output: Returns a Blob that can be downloaded or displayed

Audio Support

The library supports adding audio tracks to your videos. Audio tracks are automatically mixed with proper delays and volumes:

// Add audio to your store
store.addAudio({
  src: 'https://example.com/audio.mp3',
  delay: 0, // Delay in ms before audio starts
  startTime: 0, // Relative start point in the audio (0-1)
  endTime: 1, // Relative end point in the audio (0-1)
  volume: 1, // Volume level (0-1)
});

// Export with audio (enabled by default)
const videoBlob = await storeToVideo({
  store,
  includeAudio: true, // default: true
});

// Or disable audio
const videoBlob = await storeToVideo({
  store,
  includeAudio: false,
});

FAQs

Package last updated on 22 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts