Since the issue was in the process of reproducing a second time this morning, I was able to code my workaround into place while the problem was still happening, and then watch it correctly detect and fix the problem.

The detection is: After the script sets the key, instead of assuming that it set the key correctly, it rechecks the key to see if it really did set it correctly. If not, then the script throws away the YouTube stream and creates a new one from scratch, hopefully the new stream won't have the bug-inducing first four digits.

This has the potential to get into an infinite-correction loop if YouTube keeps repeatedly doling out keys that start with four decimal digits. But that's not something I can fix on my end. Hopefully I can get Synology to fix their root cause and they'll push out an update to Surveillance Station so that my workaround code never gets hit.
_________________________
Tony Fabris