# Supported Input Formats for Lesson Generation in OpenMAIC

> Discover OpenMAIC's supported input formats for lesson generation. Learn how PDFs, Word docs, PPTs, and more are processed to create engaging lessons.

- Repository: [MAIC/OpenMAIC](https://github.com/THU-MAIC/OpenMAIC)
- Tags: api-reference
- Published: 2026-09-01

---

**OpenMAIC accepts eight distinct input formats for lesson generation—PDFs, Word documents, PowerPoint presentations, spreadsheets, plain text, images, audio files, and video files—each processed through specialized extractors before entering the two-stage outline-to-scene pipeline.**

OpenMAIC is an open-source AI education platform developed by THU-MAIC that transforms raw source materials into structured lessons through an automated generation pipeline. Understanding the supported input formats for lesson generation is essential for educators and developers integrating the platform, as the system routes each file type through specific extractors before executing its creation workflow. According to the repository's documentation in [`README.md`](https://github.com/THU-MAIC/OpenMAIC/blob/main/README.md) at lines 887‑892, these formats are fully supported by the upload and processing subsystem.

## Document and Presentation Formats

OpenMAIC handles standard office documents through dedicated importers located in `packages/@openmaic/importer/`, converting static files into structured lesson content.

### PDF Documents

**PDF files** undergo full-text parsing via either **MinerU** or the built-in **unpdf** parser. The extraction logic is documented in [`lib/pdf/README.md`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/pdf/README.md), which details the subsystem's support for multiple parsing providers. Once extracted, the textual content feeds directly into the outline generator.

### Microsoft Word Files

Both **`.doc`** and **`.docx`** formats are supported through the internal **docx-parser**. The parser extracts textual content while preserving document structure, feeding hierarchical headings and paragraphs into the generation pipeline as material cues.

### PowerPoint Presentations

**`.ppt`** and **`.pptx`** files are processed by the **`@openmaic/importer`** package, which reads individual slides and converts them into structured scene references. Slide content serves as direct input for the interactive scene generation phase.

## Data and Plain Text Formats

For structured data and raw text inputs, OpenMAIC provides direct ingestion capabilities without complex extraction layers.

### Spreadsheets

**Excel files** (`.xls`, `.xlsx`) and **CSV files** (`.csv`) are parsed and transformed into explanatory text or quiz items. Tabular data automatically converts into structured content suitable for interactive lesson components.

### Plain Text Files

**`.txt`** files, **Markdown documents**, and other raw text formats are accepted directly without preprocessing. These files bypass specialized extractors and enter the generation pipeline immediately, making them ideal for quick lesson prototyping.

## Multimedia Input Processing

OpenMAIC extends beyond static documents to support audio-visual materials through transcription and frame analysis.

### Image Files

**`.png`**, **`.jpg`**, **`.jpeg`**, and **`.gif`** files are indexed and can be referenced in generated slides or interactive scenes. The system maintains image metadata for proper placement within lesson layouts.

### Audio Files

**`.mp3`** and **`.wav`** files undergo transcription via **ASR (Automatic Speech Recognition)** providers. The resulting transcript becomes integrated lesson content, allowing podcast recordings and lecture audio to serve as primary source material.

### Video Files

**`.mp4`** and **`.webm`** videos trigger two parallel processes: **key-frame extraction** for visual scene generation and optional **transcription** for textual content. This dual processing enables video-based lessons with synchronized visual and textual elements.

## Technical Implementation and File Routing

When you submit a generation request via [`app/api/generate-classroom/route.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/app/api/generate-classroom/route.ts), the system inspects the uploaded asset's MIME type and extension, then routes it through the appropriate extractor chain defined in `lib/generation/`. The pipeline operates in two distinct stages: first generating a content outline from the extracted materials, then creating individual interactive scenes based on that outline.

The core generation contracts and provider-agnostic interfaces reside in `packages/@openmaic/generation/`, while format-specific importers live in `packages/@openmaic/importer/`. This separation allows the system to support new formats by adding extractors without modifying the underlying generation logic.

## Code Examples: Uploading Materials

### React UI Implementation

The workspace interface in [`app/workspace/page.tsx`](https://github.com/THU-MAIC/OpenMAIC/blob/main/app/workspace/page.tsx) demonstrates the multi-format `accept` attribute and FormData submission pattern:

```typescript
import { useState } from 'react';

export default function GenerateLesson() {
  const [file, setFile] = useState<File | null>(null);
  const [prompt, setPrompt] = useState('');

  const handleSubmit = async () => {
    if (!prompt && !file) return alert('Enter a topic or attach a file');

    const form = new FormData();
    form.append('prompt', prompt);
    if (file) form.append('material', file);

    const res = await fetch('/api/generate-classroom', {
      method: 'POST',
      body: form,
    });
    const data = await res.json();
    console.log('Generation started – job ID:', data.jobId);
  };

  return (
    <div className="p-4">
      <textarea
        placeholder="What do you want to learn?"
        value={prompt}
        onChange={e => setPrompt(e.target.value)}
        className="w-full border p-2 mb-2"
      />
      <input
        type="file"
        accept=".pdf,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.csv,.txt,.png,.jpg,.jpeg,.gif,.mp3,.wav,.mp4,.webm"
        onChange={e => setFile(e.target.files?.[0] ?? null)}
        className="mb-2"
      />
      <button onClick={handleSubmit} className="btn-primary">
        Generate Lesson
      </button>
    </div>
  );
}

```

### Direct API Integration

For server-side scripts or CI pipelines, submit materials programmatically using Node.js:

```javascript
const fetch = require('node-fetch');
const fs = require('fs');
const FormData = require('form-data');

async function generateLesson(prompt, filePath) {
  const form = new FormData();
  form.append('prompt', prompt);
  if (filePath) {
    form.append('material', fs.createReadStream(filePath));
  }

  const resp = await fetch('https://your-openmaic-instance.com/api/generate-classroom', {
    method: 'POST',
    body: form,
  });
  const json = await resp.json();
  console.log('Job started →', json.jobId);
  // Poll `/api/generate-classroom/${json.jobId}` until `status === "completed"`
}

```

## Summary

- **Eight primary formats** are supported: PDF, Word, PowerPoint, Excel/CSV, plain text, images, audio, and video.
- **Specialized extractors** handle each format: MinerU/unpdf for PDFs, docx-parser for Word, `@openmaic/importer` for PowerPoint, and ASR providers for audio transcription.
- **Two-stage pipeline** processes all inputs through outline generation followed by interactive scene creation, implemented in `lib/generation/`.
- **API endpoint** [`app/api/generate-classroom/route.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/app/api/generate-classroom/route.ts) accepts multipart FormData submissions and returns a job ID for polling completion status.
- **Source verification** for supported formats appears in the repository README at lines 887‑892, with technical specifications distributed across `packages/@openmaic/importer/` and [`lib/pdf/README.md`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/pdf/README.md).

## Frequently Asked Questions

### What file formats does OpenMAIC support for lesson generation?

OpenMAIC supports eight distinct input formats: PDF documents, Microsoft Word files (`.doc`/`.docx`), PowerPoint presentations (`.ppt`/`.pptx`), Excel spreadsheets and CSV files, plain text files, common image formats (PNG, JPG, GIF), audio files (MP3, WAV), and video files (MP4, WebM). Each format routes through a specialized extractor before entering the generation pipeline.

### How does OpenMAIC extract content from PDF documents?

According to [`lib/pdf/README.md`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/pdf/README.md), OpenMAIC implements a dual-provider PDF parsing subsystem supporting both **MinerU** and the built-in **unpdf** parser. The system automatically selects the appropriate parser based on configuration, extracting full text content while preserving document structure for the outline generation phase.

### Can I use audio and video files as source material for lessons?

Yes. Audio files (`.mp3`, `.wav`) are processed through **ASR transcription** providers, converting speech to text that feeds into the lesson content. Video files (`.mp4`, `.webm`) undergo both **key-frame extraction** for visual scene generation and optional transcription for textual content, enabling rich multimedia lesson creation.

### What happens to my file after uploading to the generation API?

Upon submission to [`app/api/generate-classroom/route.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/app/api/generate-classroom/route.ts), the system validates your file against the supported MIME types, routes it through the appropriate extractor in `packages/@openmaic/importer/`, and initiates the two-stage generation job. The API returns a **job ID** that you poll until the pipeline completes the transition from extracted outline to final interactive scenes.