PowerPoint to Video with Speaker Notes

This example demonstrates how to create a video from a PowerPoint presentation using the speaker notes for voice-over narration instead of the slide text. This is useful when slides contain minimal text but detailed speaker notes.

Overview

This example covers:

  • Getting an access token
  • Creating a video from a PowerPoint presentation
  • Using speaker notes for AI voice-over instead of slide text
  • Understanding the difference between slide text and speaker notes
  • Monitoring job status and retrieving the final video

Node.js Example

Prerequisites

npm install axios

Complete Code

import axios from "axios";

const API_BASE_URL = "https://api.pictory.ai/pictoryapis";
const CLIENT_ID = "YOUR_CLIENT_ID";
const CLIENT_SECRET = "YOUR_CLIENT_SECRET";

// PowerPoint URL to convert to video
const PPT_URL = "https://pictory-static.s3.us-east-2.amazonaws.com/Mindfulness1736335431895.pptx";

async function createPPTToVideoWithSpeakerNotes() {
  try {
    // Step 1: Get Access Token
    console.log("Step 1: Getting access token...");
    const tokenResponse = await axios.post(
      `${API_BASE_URL}/v1/oauth2/token`,
      {
        client_id: CLIENT_ID,
        client_secret: CLIENT_SECRET,
      },
      {
        headers: {
          "Content-Type": "application/json",
        },
      }
    );

    const accessToken = tokenResponse.data.access_token;
    console.log("Access token obtained successfully");
    console.log("Token expires in:", tokenResponse.data.expires_in, "seconds\n");

    // Step 2: Create Video from PowerPoint with Speaker Notes
    console.log("Step 2: Creating video from PowerPoint using speaker notes...");
    const storyboardResponse = await axios.post(
      `${API_BASE_URL}/v2/video/storyboard/render`,
      {
        videoName: "ppt_to_video_speaker_notes",
        voiceOver: {
          enabled: true,
          aiVoices: [
            {
              speaker: "Brian",
            },
          ],
        },
        scenes: [
          {
            pptUrl: PPT_URL,
            useSpeakerNotes: true,
          },
        ],
      },
      {
        headers: {
          "Content-Type": "application/json",
          Authorization: accessToken,
        },
      }
    );

    const renderJobId = storyboardResponse.data.data.jobId;
    console.log("PPT to video with speaker notes render job created");
    console.log("Job ID:", renderJobId, "\n");

    // Step 3: Monitor Job Status
    console.log("Step 3: Monitoring job status...");
    let jobCompleted = false;
    let jobResult = null;

    while (!jobCompleted) {
      const jobStatusResponse = await axios.get(`${API_BASE_URL}/v1/jobs/${renderJobId}`, {
        headers: {
          Authorization: accessToken,
        },
      });

      const status = jobStatusResponse.data.data.status;
      console.log("Current status:", status);

      if (status === "completed") {
        jobCompleted = true;
        jobResult = jobStatusResponse.data;
        console.log("\nVideo from PowerPoint with speaker notes created successfully!");
        console.log("Video URL:", jobResult.data.videoUrl);
      } else if (status === "failed") {
        throw new Error("Job failed: " + JSON.stringify(jobStatusResponse.data));
      } else {
        // Wait 5 seconds before checking again
        await new Promise(resolve => setTimeout(resolve, 5000));
      }
    }

    return jobResult;
  } catch (error) {
    console.error("Error:", error.response?.data || error.message);
    throw error;
  }
}

// Run the function
createPPTToVideoWithSpeakerNotes();

Python Example

Prerequisites

pip install requests

Complete Code

import requests
import time
import json

API_BASE_URL = 'https://api.pictory.ai/pictoryapis'
CLIENT_ID = 'YOUR_CLIENT_ID'
CLIENT_SECRET = 'YOUR_CLIENT_SECRET'

# PowerPoint URL to convert to video
PPT_URL = "https://pictory-static.s3.us-east-2.amazonaws.com/Mindfulness1736335431895.pptx"

def create_ppt_to_video_with_speaker_notes():
    try:
        # Step 1: Get Access Token
        print('Step 1: Getting access token...')
        token_response = requests.post(
            f'{API_BASE_URL}/v1/oauth2/token',
            json={
                'client_id': CLIENT_ID,
                'client_secret': CLIENT_SECRET
            },
            headers={
                'Content-Type': 'application/json'
            }
        )
        token_response.raise_for_status()

        access_token = token_response.json()['access_token']
        print('Access token obtained successfully')
        print(f"Token expires in: {token_response.json()['expires_in']} seconds\n")

        # Step 2: Create Video from PowerPoint with Speaker Notes
        print('Step 2: Creating video from PowerPoint using speaker notes...')
        storyboard_response = requests.post(
            f'{API_BASE_URL}/v2/video/storyboard/render',
            json={
                'videoName': 'ppt_to_video_speaker_notes',
                'voiceOver': {
                    'enabled': True,
                    'aiVoices': [
                        {
                            'speaker': 'Brian'
                        }
                    ]
                },
                'scenes': [
                    {
                        'pptUrl': PPT_URL,
                        'useSpeakerNotes': True
                    }
                ]
            },
            headers={
                'Content-Type': 'application/json',
                'Authorization': access_token
            }
        )
        storyboard_response.raise_for_status()

        render_job_id = storyboard_response.json()['data']['jobId']
        print('PPT to video with speaker notes render job created')
        print(f'Job ID: {render_job_id}\n')

        # Step 3: Monitor Job Status
        print('Step 3: Monitoring job status...')
        job_completed = False
        job_result = None

        while not job_completed:
            job_status_response = requests.get(
                f'{API_BASE_URL}/v1/jobs/{render_job_id}',
                headers={
                    'Authorization': access_token
                }
            )
            job_status_response.raise_for_status()

            status = job_status_response.json()['data']['status']
            print(f'Current status: {status}')

            if status == 'completed':
                job_completed = True
                job_result = job_status_response.json()
                print('\nVideo from PowerPoint with speaker notes created successfully!')
                print(f"Video URL: {job_result['data']['videoUrl']}")
            elif status == 'failed':
                raise Exception(f"Job failed: {json.dumps(job_status_response.json())}")
            else:
                # Wait 5 seconds before checking again
                time.sleep(5)

        return job_result

    except requests.exceptions.RequestException as error:
        print(f'Error: {error}')
        if hasattr(error, 'response') and error.response is not None:
            print(f'Response: {error.response.text}')
        raise

# Run the function
if __name__ == '__main__':
    create_ppt_to_video_with_speaker_notes()

Key Parameters

  • pptUrl: The full URL of the PowerPoint file (.pptx) to convert
  • useSpeakerNotes: When set to true, uses speaker notes from the PowerPoint for voice-over instead of slide text
  • voiceOver: Configuration for AI voice-over narration
    • enabled: Set to true to enable voice-over
    • aiVoices: Array of AI voice configurations
      • speaker: The name of the AI voice (e.g., "Brian")

How It Works

  1. The API fetches the PowerPoint file from the provided URL
  2. Slides are extracted and converted to images for visuals
  3. Speaker notes from each slide are extracted (not the slide text)
  4. AI voice-over is generated from the speaker notes content
  5. Each slide becomes a scene with its corresponding speaker notes narration
  6. A complete video presentation is generated

Slide Text vs Speaker Notes

  • Without useSpeakerNotes: The AI narrates the visible text on the slides
  • With useSpeakerNotes: true: The AI narrates the speaker notes, which typically contain more detailed information meant for the presenter

Use Cases

  • Create detailed narrated videos when slides have minimal text
  • Generate training videos with full explanations from speaker notes
  • Convert presenter materials into standalone video content
  • Preserve the intended presentation style where slides show key points and notes provide full explanations
  • Automatically create video tutorials from presentation materials

Best Practices

  1. Well-Written Speaker Notes: Ensure your PowerPoint has comprehensive speaker notes for each slide
  2. Clear and Concise: Write speaker notes as if you're speaking to the audience
  3. Proper Formatting: Use complete sentences in speaker notes for better AI narration
  4. Consistency: Maintain a consistent tone and style across speaker notes

Response

The API returns a job ID for monitoring the video creation progress. Once completed, you'll receive a video URL containing your PowerPoint slides with narration based on speaker notes.

Notes

  • Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your actual API credentials
  • The useSpeakerNotes parameter is only valid when pptUrl is provided
  • The PowerPoint file must be accessible via a public URL
  • Slides without speaker notes may have limited or no narration
  • If no speaker notes exist, the system will fall back to using slide text