Sefer Chofetz Chaim Chapter 4 Halacha 5 part 1 with note 23, 24

If you know the person you saw do an outlandish sin that everyone knows is wrong would not listen to your rebuke because he is foolish and a scoffer, and it’s very possible he will do the sin again then it is permissible to tell the court if you can bring another witness that saw it to testify with him so that the court will privately take the proper initiative to stop him from sinning again. If you are only one witness you can’t tell the court because the Torah says courts only accept to witnesses, one witness constitutes lashon hara since the court can’t believe you. However an individual can go to the sinner’s relatives and tell him what he did assuming they will believe as if he is two witnesses and do something about it. All this is possible because sin disrupts the wellbeing nature of the world and must be minimized as much as possible however one can only tell if he is doing purely for the sake of Heaven, to be zealous for the sake of sanctifying Hashem’s Holy Name in the world but if he has ulterior motives like he has some grudge against the sinner then it will be held against him. Even though he should divulge the information anyway in order to stop the guy from sinning more but Hashem will hold the speaker accountable for his ulterior motives. However one has to be extremely careful before telling a relative, to be sure he will accept what you are saying and try to help because there are many times when relatives don’t believe negative reports about their relatives which can lead to major arguments and fighting that is not worth it for the sake of peace. We see from here that keeping the peace is more important for the world than trying to stop others from sin. One other option is to tell the sinner’s Rav or Rebbe again assuming they will believe you like two witnesses and will keep it private. They are allowed to hate the guy and gently reprimand until he changes his ways.