Cardiff teacher Gareth Williams had indecent child images
A teacher from Cardiff who used a spy camera to film youngsters going to the toilet also downloaded more than 16,000 child abuse images, Newport Crown court has heard.
Gareth Williams, 47, admitted 31 charges including nine of voyeurism, 20 of making indecent photos and two of possessing indecent photos.
Williams admitted possessing 679 indecent moving images of children of a voyeuristic nature.
He appeared via video link from jail.
The charges included three he had previously admitted of voyeurism in a house.
Williams looked down throughout the hearing as he pleaded guilty 31 times to the charges that were put to him.
The offences took place between 2006 and January this year when Williams was arrested, the court heard.
Prosecutor Michael Jones said the total number of indecent images found on "various devices" came to 16,237 while South Wales Police's hi-tech crime unit found a further 679 "voyeuristic files" belonging to Williams.
The case was adjourned for the probation service to complete a detailed report, including a psychiatric evaluation, on Williams.
Judge Rhys Rowlands ordered for that report to be completed by 15 May with sentencing taking place either the next day or on 19 May.
He told Williams he would face a custodial sentence of some length.
At an earlier hearing, magistrates were told Williams placed a pinhole camera in a house so he could look at children's genitals as they went to the toilet.