Share via

PPT Slide ---> MP4: Anyone have experience automating the extraction of video content from a powerpoint slide so that you can store it as an .mp4 or .mov on a local device?

Anonymous
2025-03-18T19:19:17+00:00

Perhaps someone has tried to do something similar:

For some context, I have already written a python script using the python-pptx library that creates a PowerPoint from a directory of images and videos — where each slide is one file, fit to the height and width of the ppt slide (16:9). This is relatively straight forward to do — however I am also trying to create a script that can work in the reverse direction, which the pptx library does not support. PPT navively exports slides as PNGs or the ENTIRE presentation as a movie, however it can not do both. For example, if I want slides 1-6 to be a png file and slide 7 to just extract an embedded movie and save it as a mp4 or mov file. I'm not really up to speed on how ppt handles its media or xml file structure - but wanted to see if anyone had any ideas on where to start or had already taken a stab at this.

Thanks!

Microsoft 365 and Office | PowerPoint | Other | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

John Korchok 232.2K Reputation points Volunteer Moderator
2025-03-19T16:58:10+00:00

A PowerPoint file is a zipped XML archive. Video and Audio are stored as files in the ppt/media folder. The link that Jim posted will get you started. MacOS's Archive utility has a bug that doesn't allow it to unzip Office files correctly, but the command-line zip utility works as expected. I'm guessing that your script would use the command line, so you should be able to make that work.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2025-03-19T17:31:37+00:00

thanks - i put together this script which seems to do an okay job for the basic extraction:

#!/bin/bash

unzip pptx fileppt_path=$1ppt_file=$(basename "$ppt_path")

if [[ ! -f $ppt_file ]]; thenecho "$ppt_file is not a file"elif [[ $ppt_file != *.pptx ]]; thenecho "$ppt_file does not end in .pptx"fi

unzip -qq $ppt_file # suppresses output

make empty destination directory for extracted contentmkdir "${ppt_file}_dir"extracted_content_dir="${ppt_file}_dir"

open unzipped media folder with ppt content in order as it appears in the pptmedia_folder="./ppt/media"

move items matching condition to the folder we created in the parent directoryfor media in $media_folder/*; doif [[ $media == *.png || $media == *.jpg || $media == *.mp4 || $media == *.mov ]]; thenmv "$media" "./$extracted_content_dir"elseecho "media in $media_folder is not supported or not found"fidone

clean up (relationships file not always created when unzipping pptx)rm -rf ppt docProps *.xmlif [[ -d _rels ]]; thenrm -rf _relsfi

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jim G 134K Reputation points MVP Volunteer Moderator
    2025-03-18T21:08:36+00:00

    This page is a good one to get you started in understanding the XML structure of Office files: https://www.brandwares.com/bestpractices/2015/11/xml-hacking-editing-in-os-x/

    You will find that a movie that's on a slide is a also a movie file within the .zip directory that comprises the PowerPoint file.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments