Skip to content

Instantly share code, notes, and snippets.

@mcsf
Created November 24, 2018 16:56
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 mcsf/ccbc10a8214a7ececfa627c6755a2a34 to your computer and use it in GitHub Desktop.
Save mcsf/ccbc10a8214a7ececfa627c6755a2a34 to your computer and use it in GitHub Desktop.
#!/bin/bash
INPUT="$1"
OUTPUT=$(perl -C -Mutf8 -pe 's/\.mp4$/.converted.mp4/i' <<< "$INPUT")
YELLOW=$(tput setaf 3)
BLUE=$(tput setaf 4)
RESET=$(tput sgr0)
if [ -a "$OUTPUT" ]; then
echo "${YELLOW}Skipping $INPUT: $OUTPUT already exists.${RESET}"
else
echo "${YELLOW}Converting $INPUT...${RESET}"
ffmpeg -i "$INPUT" -acodec aac "$OUTPUT" > /dev/null 2>&1
echo "${BLUE}Finished $OUTPUT${RESET}"
fi
#!/bin/bash
GREEN=$(tput setaf 2)
RESET=$(tput sgr0)
find . -iname '*.mp4' -not -iname '*.converted.*' -print0 | xargs -0 -I % -P 2 any2aac %
echo "${GREEN}All done.${RESET}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment