Skip to content

Instantly share code, notes, and snippets.

@zmilonas
Last active July 1, 2021 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmilonas/e10afc9b4f99905d49033fb275d31058 to your computer and use it in GitHub Desktop.
Save zmilonas/e10afc9b4f99905d49033fb275d31058 to your computer and use it in GitHub Desktop.

ppt2aac (Powerpoint to Audio)

Intended for embedded voice recordings in powerpoint presentations. Run it with a shell script (zsh) using common binaries

Usage

This script invoked via:

./ppt2aac.sh <path to ppt(x) file (filename)>

Will produce (filename).aac in the same directory.

It will retrieve all audio recordings embedded in the presentation (voice over functionality of powerpoint, m4a file) and stitch it together into one .aac file (since .aac can be concatenated easily without transcoding).

It should work for any modern powerpoint file that is unzippable.

Requirements

  1. ffpmeg
  2. unzip
#!/bin/zsh
set -eu
local TMP_DIR=tmp-$(date +"%s")
local OUTPUT="${1%.*}.aac"
local AUDIO_FILE_PATTERN="ppt/media/*.m4a"
[[ -f $OUTPUT ]] && return 2
unzip "$1" "$AUDIO_FILE_PATTERN" -d $TMP_DIR
for f in $(ls ${TMP_DIR}/ppt/media/*.m4a | sort -V); do ffmpeg -loglevel warning -i "$f" -f adts pipe:1 >> $OUTPUT; done
rm -rf "$TMP_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment