Recommendations wanted for webcam software


Several years ago, I used to use a webcam to record hedgehogs in my garden during the night.
That was probably when I was using win 8 or 8.1.
I used to set it to record when it detected motion and got loads of footage to prove that many hedgehogs visited my garden.

I now run win11 on my powerful PC and would like to set up a webcam again to see if hedgehogs are coming into my garden.
I would appreciate recommendations for software that would allow me to use motion detection and record video to a hard drive.

Preferably free software, but might pay for the right software.