Wednesday, September 27, 2023

Fixing, Updating, or Removing Sound Libraries in DaVinci Resolve / Fairlight


Problem

Sometimes our sound files get moved around or possibly removed, but as of DaVinci Resolve 18.6 managing your sound library is still a bit challenging. In my case, I had files that were removed but they continued to show up in my searches, they just would not playback and were obviously unusable. 

Solution

Note: this solution requires modifying a program database in a way which could interrupt the proper functionality of your application. While I take steps to try and prevent any corruption, I admit I do not fully understand everything Resolve is doing with that database and this could have side-effects. If you find your file has been corrupted beyond repair, a clean install may be required. My results have been successful, but you are doing any of these things at your own risk.  

Resolve stores your information relating to your local sound library in a SQLite database. If for some reason your setup is different than mine (like for instance if it is being stored in Postgres), I imagine many things will translate, but it won't be exact and you will need to do the research required to handle that situation. 

The first thing you need to do is find the SQLite database where the sound information is stored. You can do this by opening the Project Manager window, and in Local Database, right-click and choose Open File Location.

The folder that opens will contain a folder called Resolve Projects, open that to find a SQLite file called SoundLib.db. Now close down DaVinci Resolve. Start by making a copy of this file! Name it something like SoundLib_bkup.db. It's good practice to never mess with the working version of something so that you can restore the working copy later if something goes awry. With your back-up file securely in place, the easiest way to edit our working database SoundLib.db is to use a visual database program like SQLiteStudio (which is free and open source) and then connecting the SQLite database. Once connected, you should see a list of tables like these on the left-hand side.


A database is a way to organize data. With SQL type databases, it is often best to think of it like spreadsheets, where one spreadsheet is a table. The tables we are looking for start with FLAsset which I assume stands for Fairlight Asset. 

If we double-click on FLAssetBaseClip table and click the Data tab at the top, we see a table (or spreadsheet) or information associated with these assets. 


Now double-click on the FLAssetBaseContainer table, then click the Data tab again to see what is in the table. You should see one or more rows. One column is called path and seems to contain all the paths Resolve is using to search for media.  Note the FLAssetBaseContainer id. This is the ID associated with individual media assets so that they can have a relationship (or association) with each other. 


For me, the path no longer valid is D:\CorrLabs Drive Backup\Video Resource\Fairlight Sound Library

Fortunately, the tables are set up with cascading actions, which means if we remove one record, it can trickle some effects down into other tables helping us clean things up. We are going to leverage this to make our job simpler. With a SQLite file backup in place, click the row you wish to delete and then click the red icon with a line through it (on hover it will say: Delete selected row). 
 

Once you click this, the row will blank out. This is a preview of the action that is about to take place. If you selected the incorrect row, you can click the red icon with a white X (rollback) on it to undo that. If you have the right row selected that you wish to continue to remove it, click the green icon with a white checkbox. This will make your change to delete this row. 

Now the FLAssetBaseFile table will have lost the container_cookie reference (which is actually the ID we noted earlier), so let's go clean those records up. Right-click on the FLAssetBaseFile table and choose Generate query for table -> SELECT.

Delete the existing query (SELECT...) and paste: 
DELETE FROM FLAssetBaseFile where container_cookie is null;

And now hit the blue play icon at the top of the query window to run it.

The Status window will give us insight into how many records were removed. 


Now you can disconnect from your SQLite database (the plug disconnecting icon near the top left), close your SQLiteStudio and launch Resolve.

The sounds associated with the old library location should no longer appear in Fairlight!



For Errors: If you ran into an error during this process, first close the SQLite editor (SQLiteStudio) and Resolve without saving anything. With those programs closed, rename the SoundLib.db file to something like SoundLib_bad.db, and rename SoundLib_bkup.db (created from before) to SoundLib.db and restart Resolve. You should now (hopefully) have a sound library state that was the same as before any of this process took place. 




 


No comments: