Keeping my music offline

| ~5 minute read


In the age of streaming, here I am, keeping an offline library of music. Let's talk about why and how I do it, and my experience so far.

Note: There are multiple ways to get music offline. You can buy music in various formats, and you can just download from any website. Lets not discuss the ethicality of either of these options.

The issues with YouTube

I used to primarily use YouTube for music. Their recommendations are good, and all the creators post there. But there were many issues with that, though I still go there in search for new songs.

One major issue I've had is videos suddenly disappearing from my playlist due to various reasons. Sometimes they get blocked in my area for some reason, sometimes they get deleted. This is annoying especially because YouTube doesn't even show the title of those "Unavailable" videos.

Why not Spotify, etc?

I already have a YouTube account, and with uBlock Origin on PC, and NewPipe on my phone I have background play and no ads. Same can't be done for Spotify, amirite? Also since I'm already on YouTube I see no valid reason to create a new account on another service; I'd rather just have one.

I also once tried Amazon Music (not sure if it still exists) and also Gaana (not sure about that either!) and hated pretty much both of them. Youtube is nice.

The pros of downloading music

I've been downloading for 3-4 months. And have seen many benefits so far.

Here are some highlights:

The major downside

Managing a library is a long process. It's definitely not as straightforward as just adding a song to a playlist. Sometimes you can download the song files officially but sometimes you have to make do with things like yt-dlp

In such cases the file may not have the correct metadata which might be fine for some people but definitely not for me. I have spent a good amount of time properly setting the title, file name, album art, artist, etc using this handy tool called tageditor. I even add the lyrics to the mp3 file so I can be fully offline and check the lyrics whenever I want to! This is a long and still ongoing process though.

Just as a note it is possible to add metadata using ffmpeg but the reason I don't use it is a whole new story.

The "Screening Process"

I don't wanna waste disk space on songs I don't like, so I have a "Screening Process" to decide what makes it into the local library. It goes like this:

It's neither perfect or consistent but works for me!

My setup

On my phone I use RetroMusic which is available on F-Droid. It is a beautiful music player app which is highly customizable. It is arguably the best music player app on android.

My laptop is where all the major stuff happens. I download music, add metadata with tageditor if needed, and move the files to my songs folder. Then the folder is synced to my phone and optionally on a USB flash drive that can be plugged into the car, etc (saves my phone's battery!). To listen to music on the laptop I just use mpd and ncmpcpp.

If you want to download audio from YouTube just run this simple command replacing the URL accordingly:

yt-dlp -x --audio-format mp3 "https://youtu.be/JJ9IX4zgyLs"

Here's how you can download a whole playlist:

If I'm not wrong, yt-dlp can take URL of a playlist as input, but with large playlists it might fail or take too long. Sometimes you might want to partially download a playlist and resume the process later on. Use this script for that:

in this example I'll call it dl.sh

#!/bin/bash

FILE=$@
LINES=$(cat $FILE)

counter=1
for line in $LINES; do
  yt-dlp -x --audio-format mp3 "https://www.youtube.com/watch?v=$line" || echo "$line" >> "$FILE""_failed"
  counter=$((counter+1))
  tail -n "+$counter" "$FILE" > "$FILE""_remaining"
done
rm "$FILE""_remaining"

Steps:

This is post 06 of #100DaysToOffload