PPT to Video Converter
Convert PowerPoint presentations to narrated videos with AI-generated voiceover, preserving all slide animations and styles.
How It Works
- Analyze PPT - Extract slide count, text content, and animation metadata
- Generate TTS - Create AI voiceover for each slide using edge-tts (zh-CN-XiaoxiaoNeural)
- Fix Animations - Modify PPTX XML to auto-play all animations (avoid click-trigger issues)
- Record Slideshow - Launch WPS COM slideshow, capture screen at native resolution
- Encode Video - FFmpeg encodes frames to 1920x1080 H.264
- Merge Audio - Concatenate per-slide audio, merge with video
- Output - Final MP4 video file (optional ZIP packaging)
Requirements
- Windows with WPS Office installed (WPS COM:
KWpp.Application) - Python 3.8+ with:
edge-tts,mss,Pillow,lxml,pywin32 - FFmpeg + ffprobe (chocolatey:
choco install ffmpeg) - Screen resolution: 1920x1080 recommended
Usage
Basic Usage
User: 帮我把PPT转成视频,要有配音
User: Convert my PPT to video with voiceover
The skill will automatically:
- Read the uploaded PPT file
- Generate TTS audio for each slide
- Record the PPT slideshow with animations
- Output a synced MP4 video
Advanced Options
- Duration: Control per-slide timing by adjusting TTS text length
- Voice: Default
zh-CN-XiaoxiaoNeural(female), can usezh-CN-YunxiNeural(male) - Rate: Default
+10%, adjust for faster/slower speech - Subtitles: Optional, set
ENABLE_SUBTITLES=truein script - Resolution: Default 1920x1080, adjustable via
TARGET_WIDTH/TARGET_HEIGHT
Technical Details
Key Design Decisions
WPS COM over PowerPoint COM: WPS
KWpp.Applicationis more reliable in sandboxed environments. PowerPoint COM may fail due to license/activation issues.Animation Auto-Play Fix: The critical step that prevents "PPT plays too fast" issue. We modify the PPTX XML to change
delay="indefinite"todelay="0", making all click-triggered animations play automatically. This avoids the problem where extra clicks/spacebar presses accidentally advance slides.Screen Capture: Use
msslibrary for high-performance screen capture. Typical capture rate: 11-15 fps on 1920x1080. The video is encoded at the calculated fps to maintain perfect sync.Audio Sync: Per-slide TTS audio is generated first. Slide durations are set to match audio durations exactly. The video is encoded with
calc_fps = total_frames / total_durationto ensure frame count matches audio length.Binary Copy: Due to potential filesystem permission issues, final video is binary-copied (read bytes, write bytes) rather than using file copy utilities.
Scripts
| Script | Purpose |
|---|---|
scripts/ppt_to_video.py |
Main pipeline script - runs the full conversion |
scripts/fix_ppt_animations.py |
Standalone PPTX animation fixer |
Output Paths
- Temporary files:
c:\Users\Admin\.trae-cn\work\<session_id>\ppt_video\audio/- Per-slide MP3 filesframes/- Captured JPEG framesvideo.avi- OpenCV encoded video (if FFmpeg fails)merged.mp3- Concatenated audio
- Final output:
d:\trae\wendang\ppt-video-final.mp4 - ZIP package:
d:\trae\wendang\ppt-video-final.zip
Troubleshooting
| Problem | Solution |
|---|---|
| PPT plays too fast | Ensure animation fix is applied (fix_ppt_animations.py) |
| WPS COM not found | Install WPS Office, verify KWpp.Application in registry |
| FFmpeg can't write files | Use OpenCV encoding fallback or pipe mode |
| Audio out of sync | Verify calc_fps = valid_frames / total_audio_duration |
| Empty video file | Binary-copy from C: to D: instead of direct write |
| Low fps | Close other apps, reduce monitor resolution to 1920x1080 |
Workflow Example
# 1. User uploads presentation.pptx
# 2. Skill reads PPT, extracts text
# 3. Generate TTS (12 slides → 12 MP3 files, ~2.5 min total)
# 4. Fix animations (XML: indefinite → 0)
# 5. Launch WPS slideshow, record 145s
# 6. Encode: 1888 frames @ 12.96fps → 1920x1080 H.264
# 7. Merge audio + video → final.mp4
# 8. Output: 4.47MB ZIP
Limitations
- Windows only (requires WPS COM)
- Screen capture fps depends on hardware (typically 11-15fps)
- TTS uses edge-tts (requires internet connection)
- No support for embedded video/audio in PPT slides
- Animations are auto-played (individual click timing is not preserved)