Bringing it back home: exporting your YouTube Music library

YouTube Music logo

YouTube Music is a popular service amongst digital music collectors. Like its predecessor did, Google Play Music, it allows file uploads, so your existing, lovingly curated library could be uploaded to the cloud, listened to anywhere, and it would benefit from being backed up by Google.

But what about when it’s time to move on? The service would not be attractive if you were unable to take your library back. Fortunately you can, but the state of the library when exported is not quite as we’d like.

Here’s how to use bliss to fix your Youtube Music backups!

The closure of Google Play Music in October 2020 was met with disappointment by many music collectors. Although still a streaming service, Google Play Music (GPM) permitted uploads of existing music files. It was a music locker, which allows certain advantages; an existing music library, lovingly built, can be backed up securely online. With other streaming services like Spotify not allowing uploads, some were worried they wouldn’t be able to secure a cloud-based home for their music libraries.

They needn’t have worried; YouTube Music stepped into that gap. Google offered an easy transfer from one service to the other.

But for those not interested in moving to the new service (many preferred GPM) or those that gave YouTube Music a try and had decided against using it, how were they to retrieve their music library now?

Google offer a service called Takeout which is a way of exporting data from different Google services. Takeout can be used to export YouTube Music libraries, including the actual music files and some playback statistics. And, up to October, GPM also allowed your library to be downloaded in the same way.

Unfortunately, the reactions to the exports generated by Takeout were not wholly positive. Some bemoaned the lack of structure in the resulting export:

In addition, many reported missing tracks although it appears that simply trying again can sometimes make the missing tracks appear in subsequent attempts.

On the upside, reports suggested the files are tagged which is probably the most essential thing. So long as you have the tags you can identify your music easily, and restructure it as you require.

Let’s get to the bottom of this and provide a little clarity on Takeout exports.

Requesting a Takeout

Let’s take a look at a Takeout music export; broadly, the same findings apply both to YouTube Music’s exports and Google Play Music’s.

Via Takeout, you can request your YouTube data to be exported. First, you have to scroll through all of the Google services listed; this includes Drive, Chrome, Photos and many, many more. Once you get to the bottom of the list and find YouTube you’ll also realise, of course, that YouTube extends to much more than just your music library.

To request only your music related data, click the All YouTube data included button and make sure to choose just music-library-songs and music-uploads (the former includes music library stats and spreadsheets of the structure of your music library, the latter is the files you have uploaded themselves).

Selecting only YouTube music data

Click Next step and you’ll get a few more options, and then a request for your export will be generated. A short while later you should get a notification that the export is ready for download.

YouTube Music Takeout download

Once downloaded, it’s time to open the archives and see what we’ve got!

Takeout X-ray

The structure of the Takeout archive is the same for both YouTube Music and Google Play Music:

$ tree
.
└── Takeout
    ├── archive_browser.html
    └── YouTube and YouTube Music
        ├── Playlists
        │   └── [...]
        └── music-uploads
            ├── A Space Boy Dream.mp3
            ├── A Summer Wasting.mp3
            ├── Bloodflood.flac
            ├── Breezeblocks.flac
            ├── Chickfactor.mp3
            ├── Dirty Dream Number Two.mp3
            ├── Dissolve Me.flac
            ├── Ease Your Feet In The Sea.mp3
            ├── Fitzpleasure.flac
            ├── (Interlude 1).flac
            ├── (Interlude 2).flac
            ├── (Interlude 3).flac
            ├── Intro.flac
            ├── Is It Wicked Not To Care_.mp3
            ├── It Could Have Been A Brilliant Career.mp3
            ├── Matilda.flac
            ├── Ms.flac
            ├── music-uploads-metadata.csv
            ├── Seymour Stein.mp3
            ├── Simple Things.mp3
            ├── Sleep The Clock Around.mp3
            ├── Something Good.flac
            ├── Taro _ Handmade.flac
            ├── Tessellate.flac
            └── The Boy With The Arab Strap.mp3

All files are in one folder - music-uploads - with no sub directories. That’s repeated in GPM:

$ tree
.
└── Takeout
    ├── archive_browser.html
    └── Google Play Music
        ├── Playlists
        │   └── [...]
        ├── Radio stations
        │   └── [...]
        └── Titles
            ├── 25.csv
            ├── 2raumwohnung - Pop Giganten - Urlaubshits(020)3.mp3
            ├── 2 Teufel.csv
            ├── 36 Grad.csv
            ├── 6 Billionen.csv
            ├── Al Bano _ Romina Power - Pop Giganten - Ur(002).mp3
            ├── Alice Cooper - The Best Of Alice Cooper(001)Poi.mp3
            └── [...]

The only real difference in terms of structure is the naming of the Google Play Music/YouTube Music directory. In addition, the filenames themselves have a different pattern, but it’s unclear to what extent this depends on the original uploaded filename. In the case of YouTube Music, the filenames do not have the track numbers in, even though the original uploaded files did.

There’s one CSV file for each song. The CSV contains some metadata not stored in the music files which relate to the use of the streaming service, for example play counts and ratings:

Title,Album,Artist,Duration (ms),Rating,Play count,Removed
"Kaspar","Unendlich","Schandmaul","190875","0","4",""

An aside: any “in progress” uploads get an auto generated filename:

        ├── k1sBwLQw7bw.flac

… so it might be worth waiting for any uploads to finish before creating your “Takeout”.

In summary, then, while a Takeout treats your tags well, we need to do something about the filenames. File naming is the type of thing you want to do once, and it’s best done early. Let’s use bliss to fix the filenaming into a sane structure.

Fix YouTube Music exports with bliss

Your first decision is to choose how to store your music files in your filesystem. I generally recommend something like:

album artist/album name/disc number [optional]/tracknumber-track name

This provides the minimum metadata to communicate identity and structure of the release and it does not include fields like GENRE which might change in future. You don’t want to be changing your music file and folder naming.

Once you’ve decided, download bliss, install and run:

  • Download
  • Download
  • Download

The first page you’ll see is the setup page:

Setup page - choose your music folder

Choose the location of your music files. This should be the folder into which the Takeout archive was extracted. Click Next. On the next page, you get the chance to add your rules. In this case, we’ll set a rule to make sure all the files are stored in our desired location. Click Add a rule > Configure next to File paths and then set this pattern:

<album_artist>/<album_name>/<discnumber>?|Disc <discnumber:nn>/|<tracknumber>?|<tracknumber:auto>-|<track_name>

This mimics our desired pattern we described above. If you want something different, click Custom paths to explore the different ways you can customise the file paths.

Make sure the rule is set to run in Manual mode first.

Click Scan library and apply rules and bliss will begin assessing your music files.

As bliss scans, it works out which track is in which album. Once it has an idea of your albums it can work out what the file path should be. Those files it can see that are not named according to your file pattern will be shown:

An album with non-compliant file paths

You can click the Fix all file paths link to fix all the files in this album, or click more info to see the current and target file paths. In fact, I encourage you to do this early on to make sure bliss is suggesting appropriate file locations.

Once you’re more confident you can fully automate the file renaming. Either fix all outstanding issues in the Inbox by clicking Select by type > check Fix folder and file structure > Fix all or by changing the rule to run automatically - in the settings page change Manual to Automatic.

Once you’re done, you should have a reorganised music folder, with all your YouTube Music/Google Play Music organised into folders.

Thanks to Timo Schmidt for letting me see the structure of his Google Play Music Takeout export.

tags: cloud streaming
blog comments powered by Disqus

The Music Library Management blog

Dan Gravell

I'm Dan, the founder and programmer of bliss. I write bliss to solve my own problems with my digital music collection.