I've just looked on geek bench
As mentioned by the previous poster my hunch is, despite the lower clock speed and older architecture the i7 is likely to be faster in the task you picked which is handbrake. Handbrake will make use of the i7s ability to hyper thread.
That said, the geek bench results show a modest 5-10% speed advantage in their test results in favour of the mbp i7. I would expect this to roughly translate to the advantage the mbp has.
For a typical film encode you might only be talking a further 5 mins wait time. In fact the gap might be thinner if the mbp cannot dissipate it's heat as well as the cooler running roomier haswell i5 iMac.
Unfortunately on the 27" iMac you have to go quite a way up in price to get an i7. On the 21.5" its just £160 in the UK. On the 27" you need to choose the 3.4, do the upgrade and get the bigger gpu, another £340 over the base, over twice the cost compared to the 21.5" upgrade.