I would have stopped and made my presence known, even if I didn't verbally say anything. I live in a low-income neighborhood and was recently in this situation. My kids and I all stopped near the officer and watched him intently - phones out - until he let the suspect go. I use the word "suspect" loosely, as the man lived in our neighborhood and we knew he was not causing any trouble.
If you don't feel safe intervening, record the situation so you can help the victim later. Just please don't post it on TikTok or YouTube without their consent. I see this happen a lot.
My family member, who has colorful hair, tattoos, and many piercings, has also been harassed by police in our area. I tried to run down and help her one time when she was pulled over, but she begged me to stay home. She was afraid I'd make things worse for her and anger the officer. I honored her request, but I wished I had done more since the experience left her pretty shaken up.