Why do we need motion vectors in MPEG? I'm trying to understand how the encoding of a I and P Frame works.
The I frame is just encoded like a JPEG image.
I'v read that for the P-Frame we need to calculate some motion vectors, apply it to the reference image and calculate the difference between the target and the reference image.
Why do we need such motion vectors? Why can't we just take the difference of the I Frame and the B Frame and encrypt it?
Thanks
Because that's way more efficient at encoding a lot of typical scenes.
Imagine this: you're filming a complex scene with lots of different objects. The camera shifts ten pixels to the right; with your approach, you'll have to save a relatively large difference for every pixel on average, because the pixels 10 px to the left aren't very similar.
When you first encode the fact that this is just a shift by 10 px, that needs nearly no space at all - and then you'll just need to encode how the scene actually changed.