Search Docs
Loading...
Skip to content

To WebM

Export video compositions as WebM files on the server with VP8, VP9 or AV1 video and Opus or Vorbis audio.

WebM is an open video format. Its codecs are royalty-free, so you can encode and publish them without a patent license.

Use the Native Package#

The WebAssembly package @cesdk/node does not export video. Its engine.block.exportVideo() throws an error. Install the native package @cesdk/node-native instead. It bundles the VP8, VP9, AV1, Opus and Vorbis encoders, so a WebM export works the same on macOS, Linux and Windows.

Terminal window
npm install @cesdk/node-native@1.86.0

The scene, block and export APIs of the two packages are the same, so the rest of your server code does not change.

Export to WebM#

Call engine.block.exportVideo() with a page block and set mimeType to 'video/webm'. The method returns a Blob with the WebM file. Without other options, the export encodes VP9 video and Opus audio.

import fs from 'fs/promises';
import CreativeEngine from '@cesdk/node-native';
const engine = await CreativeEngine.init({ license: 'YOUR_CESDK_LICENSE_KEY' });
try {
await engine.scene.loadFromURL('https://example.com/my-video.scene');
const page = engine.scene.getCurrentPage();
const blob = await engine.block.exportVideo(page, { mimeType: 'video/webm' });
await fs.writeFile('./output.webm', Buffer.from(await blob.arrayBuffer()));
} finally {
engine.dispose();
}

The native Node.js guide shows how to select the codecs, keep the transparency of the page and export audio only.

Troubleshooting#

  • The export throws “Exporting video is currently not supported on Node.JS”: The code imports @cesdk/node. Import @cesdk/node-native instead.
  • The export fails with ENCODE.VIDEO_CODEC_CONTAINER_MISMATCH or ENCODE.AUDIO_CODEC_CONTAINER_MISMATCH: A codec does not fit WebM. Use VideoCodec.VP8, VP9 or AV1 with AudioCodec.Opus or Vorbis, or leave the codecs at Auto.

Next Steps#