They may have never been charged with rape had it not been for the video surveillance camera.

After all, who doesn’t believe a police officer?

But the video became one of the strongest pieces of evidence against two New York City Police officers who have been charged with raping a 27-year-old drunk woman who was passed out on her bed after vomiting several times.

The officers, Kenneth Moreno and Franklin Mata, had helped the woman into her East Village apartment in December after receiving a call from a cab driver saying she was unable to pay the fare.

After escorting her inside her apartment, the officers returned twice in that same evening, including one time after they allegedly placed a false call to dispatch from a public phone in order to justify their return to the building.

it was the third time when Officer Moreno allegedly raped the woman as she laid face down on her bed. Officer Mata stood guard outside the door of the apartment as the rape took place, prosecutors told the New York Post.

Surveillance video captured them shielding their faces from a camera they spotted on the second trip. The two didn’t realize a separate camera caught their attempts to conceal their identities.

Their actions that night and during the following days — when they allegedly faked logbook entries — prompted prosecutors to build cases against both officers and eventually to reject a purported offer by Mata to testify against his partner.

Investigators also found heroin in Moreno’s locker, adding to his stellar reputation as a police officer.

The officers, who have pleaded not guilty, insist the sex was consensual, even though the woman’s blood alcohol content was between .20 and .33, according to Newsday.

Besides the videotape, investigators have also obtained an audiotape of a conversation between Moreno and the victim after the alleged incident where he apologized, according to the Post.

Wired with a hidden device, she arranged a meeting with Moreno, who apologized to her for his actions that night and conceded that she had been extremely intoxicated, sources said.

The probe involved numerous forensic tests at the woman’s apartment and interviews with virtually everyone who came in contact with the cops and her, including cabby Kofi Owusu, who took her home, residents in her building, and the two drivers involved in the accident.

The officers have been charged with rape, burglary and official misconduct.