Automatically convert videos in Powerpoint file (pptx) to a different format

I have been trying to convert a lot of embedded videos in pptx files to a different format lately due to compatibility issues on some systems, but have not found an easy and fast way – so I wrote this bash script.

The goal was to have a pptx with videos that can be played using Powerpoint 2010 or later on Windows as well as OS X without plugins. That seems to only be the case for MPG videos (mpeg1video codec).

To convert videos in a presentation

  1. make sure that ffmpeg and a zip/unzip application is installed (ffmpeg can easily be replaced by avconv, but avconv somehow could not convert some files that were no problem for ffmpeg during my tests)
  2. download the bash file and make it executable
  3. edit the options at the beginning of the file, if you want to (mainly video output format and bitrate)
  4. Change to the directory with the pptx file(s) and start the conversion with /path/to/ myPresentation.pptx
  5. Check if everything worked by looking at myPresentation_converted.pptx  or the logs

I’m not sure whether this will work with all pptx files. It assumes that videos are in the folder ppt/media , have the names media[0-9]*.EXT  (EXT just being any extension) and are only directly referenced by files in ppt/slides/_rels .

The script does the following:

  1. unzip pptx
  2. transcode video files using ffmpeg
  3. update file references in ppt/slides/_rels
  4. add MIME type to [Content_Types].xml  (especially this might go wrong)
  5. Rezip contents


Leave a Reply

Your email address will not be published. Required fields are marked *