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?



1 Answer 1


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.

  • $\begingroup$ Thank you very much! $\endgroup$ Jan 4, 2021 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.