This problem was discussed in this and this thread. Shanee mentioned it could be related to sleep and power management. This is true in some situations [German link] but since sleep (AFAIK) is not working with Catalina on AMD systems, it should be disabled by default through NullCPUPowerManagement.kext and you should also turn off automatic sleep in Catalina's power saver options.
The cause of the freezing/crashing (kernel panic) is the daemon mediaanalysisd which attempts to curate any videos in your photo library, assuming you have one. So users that a) don't have a photo library or b) don't have videos in it should NOT be affected by the issue. Some people have theorized that the issue might only appear on certain video cards, most likely Navi cards (because of buggy drivers).
The issue can be tracked down as follows:
1) Remove the photo library from "Pictures" by moving it to the trash (do not empty the trash). The system will be stable.
2) Put the library back, open Activity Monitor and sort by CPU load. Wait five to ten minutes and when the system freezes, mediaanalysisd will be at the top of the process list.
3) Disabling/deleting mediaanalysisd stops the freezes from occurring.
Source to confirm this problem has existed since Sierra. This thread also describes that simply disabling the daemon with a Terminal command will likely fail:
sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist: Could not find specified service
The thread suggests to delete the plist file instead of disabling it. I did that (backing it up first!) and rebooted, but the daemon STILL launched after idling. So the plist file is not the trigger in this situation. My guess is that photoanalysisd or photolibraryd are controlling the start of mediaanalysisd.
I ended up outright removing mediaanalysisd which completely fixed the problem. This is not very elegant but it does work! As always, BACK UP the file you are deleting in case it's needed in future!
You can run these Terminal commands to automate the process. The first command is required since you need write access to the Catalina system files. The following commands remove mediaanalysisd and its plist file after backing them up to your desktop.
DO THIS AT YOUR OWN RISK! I'm not liable for any damage you do to your Catalina installation. Use common sense!
sudo mount -uw / sudo cp /System/Library/PrivateFrameworks/VideoProcessing.framework/Versions/A/mediaanalysisd ~/Desktop sudo rm /System/Library/PrivateFrameworks/VideoProcessing.framework/Versions/A/mediaanalysisd sudo cp /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist ~/Desktop sudo rm /System/Library/LaunchAgents/com.apple.mediaanalysisd.plist
Feedback is appreciated in this thread. If anyone wants to add info, I'd be interested in what triggers mediaanalysisd so the trigger can be removed. I hope this solution proves useful to those having the problem.
AMD Ryzen 3700X / MSI X570 Gaming Carbon / 2x 8 GB DDR4-3200 G.Skill Trident Z / AMD Radeon RX 5700 XT / Samsung 850 SATA SSD