Just in case you wondered how many photos you really can have in your Apple Photos library, I can report that I have so far added 1 000 264 Photos and 10 242 Videos without any issues.
I’m fairly impressed and happy about it since all I could find was that it should support up to 100.000 photos, with a few reasoning about the limit being increased to 300.000 on modern hardware.
I’m running this on my MacBook Pro M2 Max with 64 GB ram.
Most formats gets converted to HEIC and HEVC on import, which are staggeringly effective compared to their original formats. The whole library file still only takes up 1.7TB, which is much less than expected. The original source on my NAS is around 5.6 TB.
Edit: Maybe I should add that I do not recommend this, and view it as an experiment for now. I’m still importing data. If it’s still stable and performant after a year and some OS updates then I can start recommending it.
OSXPhotos
You can use it from the command line, but I use the Python interface with a custom script to handle some of my custom stuff like making sure the NAS volume is mounted, tweak some naming, more robust duplication handling etc.
I used to run iCloudPD through docker on my NAS, which works great and can sync down everything directly from iCloud. However, if you turn on Advanced Data Protection like I did, software like icloudpd can no longer access your photos.
I’ve instead added an external SSD to a Mac Mini server and set it to download all originals, then I run the script on a schedule every night to export anything new to my NAS. Then the backup of my NAS to an encrypted cloud location will kick in a few hours later.