As one of the comments mention Desktop Duplication API is a native low-level API, check this repo https://github.com/bmharper/WindowsDesktopDuplicationSample.
I read also your comment regarding "stick to WPF", there are 2 options in my opinion.
The first one is a very simple RecordBook-Screen-Recorder, it is made in WinForms, and the UI is not in English but very easy to understand, I share it for inspiration: https://github.com/iEmreM/RecordBook-Screen-Recorder.
That said, I have previously played with Captura open source recording in .net and WPF, it can capture video and sound.
here is the repo, the latest updated 2 years. https://github.com/MathewSachin/Captura.
It is feature-rich software as well.
With that said, you might search and find something more, but you won't find complete software that has everything without issues.
In addition, check this article does not cover what you need but gives inspiration to your comment regards Windows Graphic Capture API.
https://blogs.windows.com/windowsdeveloper/2019/09/16/new-ways-to-do-screen-capture/