Personally I find devices that record locally or to user-owned services perfectly fine, keeping local recordings on your dashcam's SD card, awesome, keeping your home recordings on your NVR, NAS or private server, that's okay, but sending that to corporate or government owned services is generally bad. There's a limit to how much an individual can do with the data they record from a few places they own, their car, their house, etc. There's no limit to how much abuse a large entity can do with that data, facial recognition and more computing power than they know what to do with.
Drawing this line legally however is... extremely challenging.
The reality is what we have here is a tradeoff between freedom and security with any individual CCTV camera. Those are both valuable things in their own right and such tradeoffs should be made carefully.
When we then hand that data off to a corporation or government entity, that tradeoff looks very different - now they have access to thousands if not millions of sensors. The freedom implications become much higher and the security is often replaced with things like "how good is our traffic data?", "how can we improve our self-driving system to sell more cars?" or "how can the Chinese government bust more Muslims?". The aggregated result is rarely worth it.
In the US, you won't get in any legal trouble for doing this. You do have certain restrictions on what you can do with the images you capture, though.
IANAL.
You should not get into any legal trouble if you're doing it by yourself. There is no expectation of privacy in public spaces in the US.