PPTX

Media

Embed video and audio files into slides with poster images

Embed video and audio content into your presentations using the video and audio slide element types.

The data and poster fields accept raw bytes (Uint8Array, ArrayBuffer, Buffer) or a base64 data URL such as data:image/png;base64,....

Video

import { generatePresentation } from "@office-open/pptx";
{
  "slides": [
    {
      "children": [
        {
          "video": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "15.9cm",
            "height": "10.6cm",
            "data": "data:video/mp4;base64,AAAAHGZ0eXBtcDQy...",
            "type": "mp4"
          }
        }
      ]
    }
  ]
}

Video with Poster Image

A poster image is shown before the video starts playing:

{
  "slides": [
    {
      "children": [
        {
          "video": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "15.9cm",
            "height": "10.6cm",
            "data": "data:video/mp4;base64,AAAAHGZ0eXBtcDQy...",
            "type": "mp4",
            "poster": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
            "posterType": "jpg"
          }
        }
      ]
    }
  ]
}

If no poster is provided, a minimal transparent placeholder is used automatically.

Audio

import { generatePresentation } from "@office-open/pptx";
{
  "slides": [
    {
      "children": [
        {
          "audio": {
            "x": "1.3cm",
            "y": "10.1cm",
            "width": "5.3cm",
            "height": "1.3cm",
            "data": "data:audio/mp3;base64,SUQzBAAAAAAAI...",
            "type": "mp3"
          }
        }
      ]
    }
  ]
}

Supported Formats

Video (type)

ValueFormat
mp4MP4
movMOV
wmvWMV
aviAVI

Audio (type)

ValueFormat
mp3MP3
wavWAV
wmaWMA
aacAAC

Options

Video

| Property | Type | Default | Description | | ------------ | ---------------------------------- | ----------------- | ------------------- | --------------------------------------- | | x | number | UniversalMeasure | 0 | Left position (EMU or UniversalMeasure) | | y | number | UniversalMeasure | 0 | Top position (EMU or UniversalMeasure) | | width | number | UniversalMeasure | 0 | Width (EMU or UniversalMeasure) | | height | number | UniversalMeasure | 0 | Height (EMU or UniversalMeasure) | | data | Uint8Array | - | Video file data | | type | "mp4" \| "mov" \| "wmv" \| "avi" | - | Video format | | name | string | auto | Display name | | poster | Uint8Array | auto | Poster image data | | posterType | "png" \| "jpg" | "png" | Poster image format | | animation | AnimationOptions | - | Play animation |

Audio

| Property | Type | Default | Description | | ----------- | ---------------------------------- | ----------------- | --------------- | --------------------------------------- | | x | number | UniversalMeasure | 0 | Left position (EMU or UniversalMeasure) | | y | number | UniversalMeasure | 0 | Top position (EMU or UniversalMeasure) | | width | number | UniversalMeasure | 0 | Width (EMU or UniversalMeasure) | | height | number | UniversalMeasure | 0 | Height (EMU or UniversalMeasure) | | data | Uint8Array | - | Audio file data | | type | "mp3" \| "wav" \| "wma" \| "aac" | - | Audio format | | name | string | auto | Display name | | animation | AnimationOptions | - | Play animation |

Tips

  • Provide a poster image for videos to ensure a visual preview is shown before playback.
  • Audio frames are typically small and positioned at the bottom of a slide.
  • Media files are embedded directly into the .pptx file — keep file sizes reasonable for performance.
  • Supported playback depends on the presentation viewer (PowerPoint, Keynote, Google Slides, etc.).
Copyright © 2026