Fixing iPhone Videos in Powerpoint

We ran into some trouble last week when we wanted to run a Powerpoint presentation with video embedded that was captured on an iPhone. The windows computer just didn’t play it at all at first, and after installing Quicktime it played the video rotated. Rotating the video manually then messed up the aspect ratio, so we recoded all videos and did the presentation again manually.

Afterwards, I thought we should have just recoded the video in-place, but I didn’t have my laptop with me. If you run into similar trouble and have a unix/mac shell nearby, try this script (e.g. recode_pptx.sh your_presentation.pptx)

(make sure to have https://brew.sh/ installed, and brew install ffpmeg)

#!/bin/sh

hash zip 2>/dev/null || { echo >&2 “I require zip but it’s not installed.  Aborting.”; exit 1; }

hash ffmpeg 2>/dev/null || { echo >&2 “I require ffmpeg but it’s not installed.  Aborting.”; exit 1; }

hash unzip 2>/dev/null || { echo >&2 “I require unzip but it’s not installed.  Aborting.”; exit 1; }

rm -r __temp

mkdir __temp

cd __temp

unzip ../$1

find ./ppt/media -iname “*.mov” -exec ffmpeg -i {} -acodec copy -vcodec msmpeg4v2 “{}_new.mov” \; -exec rm “{}” \; -exec mv “{}_new.mov” “{}” \;

find ./ppt/media -iname “*.avi” -exec ffmpeg -i {} -acodec copy -vcodec msmpeg4v2 “{}_new.avi” \; -exec rm “{}” \; -exec mv “{}_new.avi” “{}” \;

find ./ppt/media -iname “*.mp4” -exec ffmpeg -i {} -acodec copy -vcodec msmpeg4v2 “{}_new.mp4” \; -exec rm “{}” \; -exec mv “{}_new.mp4” “{}” \;

zip -r ../_$1 *

cd ..

rm -r __temp

echo .

echo Completed. Resulting file : _$1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s