https://github.com/rg3/youtube-dl/
apt-get install libav-tools ffmpeg # Linux (either one of either should do) brew install ffmpeg # OSX choco install ffmpeg # Windows
youtube-dl -U
youtube-dl automatically selects bestvideo and audio for you
youtube-dl --verbose --no-check-certificate --prefer-ffmpeg --add-metadata --all-subs --restrict-filenames --embed-thumbnail --merge-output-format mp4 --recode-video mp4 -o "~/Desktop/%(title)s.%(ext)s" VIDEO_URL_HERE
youtube-dl -f bestvideo+bestaudio --extract-audio --audio-format mp3 --prefer-avconv --add-metadata --output "~/Desktop/%(title)s.%(ext)s" --playlist-random https://www.youtube.com/playlist?list=XXXXX
youtube-dl -f bestvideo+bestaudio --extract-audio --audio-format mp3 --prefer-avconv --add-metadata --output "~/Desktop/%(title)s.%(ext)s" https://www.youtube.com/watch?v=ZZZZZZZ
# e.g. merge video1.mp4, video2.mp4, video3.mp4, etc in same folder together to output.mp4
ffmpeg -v debug -f concat -safe 0 -movflags faststart $(ls -1v *.mp4 | sed "s/^/-i /" | sed ':a;N;$!ba;s/\n/ /g') -c copy output.mp4
for an online dl website
youtube-dl --extract-audio --audio-format mp3 --ignore-errors --playlist-items ITEM_SPEC 1-100 --max-filesize 30m -o %(NAME)s.mp3 --yes-playlist $1