Download Music with youtube-dl
There are some good mix on YouTube, SoundClound and MixCloud. Unfortunately it’s difficult to listen to them offline. When the artist doesn’t respond to my query, I use youtube-dl to download the mix.
youtube-dl --format bestaudio --extract-audio \ --audio-format best --audio-quality 0 \ --embed-thumbnail --add-metadata \ "URL"
youtube-dlalready download the best available quality therefore no need to pass special options. However downloading the whole video to only use the audio track is a waste of energy, which is why
--format bestaudiois set.
--extract-audiostill needs to be passed because the first option often download a video format with only an audio track which needs to be extracted/converted anyway.
--audio-formatis set to
bestby default and is most probably redundant
--audio-quality 0is the most confusing option: it sets the audio quality for the convertion (0 = better, which is itself confusing). However, with
best, one could assume a “lossless” (although files are already lossy anyway) extraction is done. In that case no need for a convertion, and, therefore, no need to use this option. But if a convertion is done, this option defaults to
5, resulting in a loss of quality. It is therefore set to
--embed-thumbnaildoes not work with
.opus(most YouTube videos)
- If using the
youtube-dl, it seems to not be able to natively find
AtomicParsleyand therefore not beeing able to embed thumbnail
Knowing that, a simpler command can be used for audio only websites:
youtube-dl --format bestaudio \ --embed-thumbnail --add-metadata \ "URL"