Shrek Forever After

Shrek has grown steadily tired of being a family man and celebrity among the local villagers, leading him to yearn for the days when he felt like a "real ogre". When he takes his family to Far Far Away to celebrate his children's first birthday, a series of mishaps further injure his ego, causing him to lose his temper and walk out in anger.
Shrek encounters Rumpelstiltskin, who seizes his chance, having observed Shrek's angry outburst. He follows Shrek and arranges for Shrek to appear to save his life. He gives Shrek a day to live like a real ogre, in exchange for a day from his childhood that he would not remember being erased to "thank" him.
Shrek signs the contract and appears in a reality where he is feared by villagers. He takes the opportunity to cause some lighthearted mischief until he finds "WANTED" posters for Fiona and his home deserted and desolate. He is kidnapped by witches and taken to Stiltskin, now the King of Far Far Away, which has become derelict and run down.
Upon inquiry, Stiltskin reveals that the day he erased was the day Shrek was born. Therefore, Shrek never saved Fiona or never met Donkey, and consequently Stiltskin was able to get King Harold and Queen Lillian to sign their kingdom away, making them both disappear. When the day ends, Shrek will disappear as well. Shrek escapes Stiltskin's castle with Donkey. Initially terrified of Shrek, Donkey decides to trust him after seeing Shrek cry over his erased history, something he had never seen an ogre do before. After Shrek explains the situation, Donkey helps him find a hidden exit clause: the contract can be nullified by "true love's kiss".
They soon encounter a band of ogres who are resisting Stiltskin. The ogres are led by a still-cursed Fiona who, after escaping from the tower where she was held captive, keeps the retired and overweight Puss in Boots as a pet. Shrek does everything he can to gain Fiona's love, but she is too busy preparing an ambush on Stiltskin. She is also bitterly cynical and disillusioned about the power of true love and throws herself into planning Stiltskin's capture. While sparring with her, Fiona begins to like Shrek, but stops short of kissing him. Puss encourages him to continue pursuing Fiona.
During the ambush, the ogres are captured by the Pied Piper, though Shrek and Fiona escape with the intervention of Puss and Donkey. Shrek insists Fiona kiss him, saying it will fix everything; however, because in this altered timeline Fiona does not truly love him, the kiss does not work. When he hears that Stiltskin is offering the "deal of a lifetime" (where all wishes come true) to the one who brings him Shrek, Shrek turns himself in and uses the deal to free the other ogres except Fiona, who then storm into the castle, battle the witches, and capture Stiltskin.
As the sun rises, Shrek begins to fade from existence, but Fiona, having fallen in love with him, kisses Shrek just before he disappears, thereby voiding the contract and restoring Shrek to his world, just before he lashed out at the party. Shrek embraces his friends and family with a newfound appreciation for everything he has truly living "happily forever after".

Question: Who captures the ogres?
Answer: Pied Piper.