You can download video and audio files for offline viewing from a variety of websites using youtube-dl . Be sure to install ffmpeg as well for tagging.
# Grab an HD MP4 (720p or the next best LARGER size).
#
youtube-dl \
--output " %(title)s (%(id)s).%(ext)s " \
--format " bestvideo[width<=1280][height>540][ext=mp4]+bestaudio[ext=m4a]/bestvideo[width<=1920][height>720][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best " \
--add-metadata " $URL "
# Grab the best quality video and audio. Will often get muxed into an MKV
# container rather than MP4, though sometimes you'll get something like
# WEBM.
#
youtube-dl \
--output " %(title)s (%(id)s).%(ext)s " \
--format " bestvideo+bestaudio " \
--add-metadata " $URL "
# Grab the best single format file less than 200 MB.
#
youtube-dl \
--output " %(title)s (%(id)s).%(ext)s " \
--format " best[filesize<200M] " \
--add-metadata " $URL "
Useful size specs:
Common video resolutions
Name Width (Max) Height Notes 480p 854 480 DVD quality 540p 960 540 “Quarter HD”, pretty uncommon (except on VHX) 720p 1280 720 Often just called “HD” 1080p 1920 1080 Often called “Full HD”
Link to original
Most of the time, you’ll need a newer version of youtube-dl than is available in your distro’s repos… Or that can be installed using pip. The easiest way to get do this is to install youtube-dl at the system level (to make sure that all the dependencies are present), and then to grab the latest youtube-dl source code from GitHub and build it in a Python virtual environment .
virtualenv youtube-dl
cd youtube-dl
. bin/activate
# Run `pip install youtube-dl` here if you DON'T have the package
# installed at the system level. This will pull in all necessary deps
git clone https://github.com/ytdl-org/youtube-dl.git
cd youtube-dl
make
# DO NO `make install` however! Instead, just run using ./youtube-dl.