Skip to content

Instantly share code, notes, and snippets.

@curiousercreative
Last active November 3, 2022 01:27
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 curiousercreative/b66314a6b89f913dca94ac1b334338dc to your computer and use it in GitHub Desktop.
Save curiousercreative/b66314a6b89f913dca94ac1b334338dc to your computer and use it in GitHub Desktop.
#! /bin/bash
askYesNo() {
local answer=
while [ "$answer" != "y" ] && [ "$answer" != "n" ]; do
read -e -n 1 -p "$1 (y/n) " answer
done
if [ "$answer" != "y" ]; then
return 1
fi
}
transcode() {
for i in *.mov; do
if [ -e "$i" ]; then
ffmpeg -i "$i" -c:v copy -c:a pcm_s16le "${i%.mov}-pcm.mov"
fi
done
for i in *.mp4; do
if [ -e "$i" ]; then
ffmpeg -i "$i" -c:v copy -c:a pcm_s16le "${i%.mp4}-pcm.mov"
fi
done
}
cd "$1"
ls -1 *.mov 2> /dev/null
ls -1 *.mp4 2> /dev/null
if askYesNo "Transcode AAC audio to Linear PCM audio and rewrap as .mov for the above files?"; then
transcode
fi
@curiousercreative
Copy link
Author

updated:

  • print files to process one per line
  • operate on .mp4 or .mov
  • output with suffix -pcm.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment