In the film too, after Harry returns from the graveyard with Cedric's dead body and "Moody" takes Harry away to his office, we see his Polyjuice potion start to wear off. He tries to take a swig of some more from his flask, but he has run out. As he is scouring his office for more, he slips up asking, "Were there others? In the graveyard, were there others?" When Harry hesitates and says, suspicious, "I - I don't think I said anything about a graveyard, Professor," Barty Crouch Jr gives his confession:
Barty Crouch Jr: "Marvellous creatures, Dragons, aren't they". Did you think that miserable oaf would've led you into the woods if I hadn't suggested it? Do you think Cedric Diggory would've told you to open the egg under water if I hadn't told him first myself? D'you think Neville Longbottom, the witless wonder, could've provided you with Gillyweed if I hadn't given him the book that led him straight to it? Huh?
This is where Harry then works out "It was you from the beginning".