Skip to content

Instantly share code, notes, and snippets.

@felixgirault
Last active April 20, 2016 07:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixgirault/0632f68afedc05d3c8308ab21e45118d to your computer and use it in GitHub Desktop.
Save felixgirault/0632f68afedc05d3c8308ab21e45118d to your computer and use it in GitHub Desktop.
Download audio from videos
cclive \
--stream best \
--filename-format "%t" \
--exec 'echo "Converting to audio..."' \
--exec 'ffmpeg -loglevel warning -i "%f" -codec copy -map 0:a "%n.mp4"' \
--exec 'echo "Cleaning temp file..."' \
--exec 'rm "%f"' \
--exec 'echo "You can now listen to %t.mp4' \
"$1" \
/
@felixgirault
Copy link
Author

This script requires cclive and ffmpeg.
You can alias it in your .zshrc:

alias dla="/path/to/download-audio.sh"

And then use it like that:

dla "https://www.youtube.com/watch?v=aFY5fXAfvG4"

It will download the audio and save it as a .mp4 file named after the video title, right where you run the command.

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