Skip to content

Instantly share code, notes, and snippets.

@saranrapjs
Last active December 27, 2015 15:09
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 saranrapjs/7345091 to your computer and use it in GitHub Desktop.
Save saranrapjs/7345091 to your computer and use it in GitHub Desktop.
Download & Slowdown a YouTube video using ffmpeg && youtube-dl
# add this to yer .bash_profile ==>
function youtube_slower {
if [ ! -z $2 ]; then
tempo="$2"
else
tempo="0.8"
fi
base_filename="$(youtube-dl "$1" --get-filename)"
extensionless="${base_filename%.*}"
output_filename="$extensionless"".slowed.mp3";
youtube-dl $1 -q -o - | ffmpeg -y -v quiet -i - -filter:a "atempo=$tempo" "$output_filename";
echo "opening \"$output_filename\"";
if [ -f "$output_filename" ]; then
open "$output_filename";
fi
}
# usage:
# youtube-slow "http://www.youtube.com/watch?v=drbnCPq5YHk"
alias youtube-slow=youtube_slower
function youtube_munch {
while read p; do
echo "munching $p...";
youtube-slow "$p"
done < <(grep '' $1)
}
alias youtube-munch=youtube_munch
# usage:
# youtube-munch path-to-text-file-full-of-youtube-urls.txt
@saranrapjs
Copy link
Author

requires ffmpeg and youtube-dl, installable via HomeBrew on the Mac:

brew install ffmpeg
brew install youtube-dl

homebrew may require the Command Line Tools, which can be installed thusly:

xcode-select --install

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