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 Engine#

@cesdk/node exports video with its native engine. The native engine 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@1.87.0-rc.3

The WASM engine, which @cesdk/node starts where the native engine cannot run, has no video export. Pass engine: 'native' to CreativeEngine.init() so that your pipeline fails at initialization instead of starting the WASM engine.

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';
const engine = await CreativeEngine.init({
license: 'YOUR_CESDK_LICENSE_KEY',
// Fail instead of starting the WASM engine, which has no video export.
engine: 'native',
});
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 rejects with ERR_CESDK_NATIVE_ENGINE_REQUIRED: The engine runs on WASM. Pass engine: 'native' to CreativeEngine.init(); the error then names why the native engine cannot start.
  • 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#