What are MPEG I, P and B frames?

I was recently going over MPEG articles and videos to understand how it works. I understand what I, P and B frames do but I do not understand how the prediction is calculated.
Assume that I want to record a video of a ball falling from the sky to the ground and then bouncing a couple of times before finally coming to a halt.
Also, I am not clear with the concept of the 16×16 macroblock.
Please tell me:

  • how prediction is calulated
  • what is macroblock and how it helps in MPEG encoding
  • My references:

  • MPEG Prediction
  • Video on MPEG conversion
  • Short answer:
    Blocks are units for inter-frame comparison;
    Prediction is based on amount of blocks presenting on both previous and following images;

    Longer answer:
    As input, a video encoder receives nothing else but a sequence of frames.
    In most cases, the adjacent frames are very similar to each other, and the encoder attempts to figure out whether these frames are indeed similar.

    How do you say if two images are similar?

    • Both images are split into macroblocks (you can’t compare entire images, they will certainly differ!)
    • The algorithm attempts to find if a block from previous image exists on the following image (within a certain proximity to its original position)
    • If, to a certain threshold, most of the blocks present on the following image, the following image is computed as a difference to the previous one (P-frame);
      • Of course, differing blocks are encoded as-is;
    • If not, the following image is considered to belong to another scene, and there’s no other way rather than keeping it entirely (I-frame).

    In order to understand how prediction works, take a look at this image. It is created by a deshaker plug-in for VirtualDub, and used for a different purpose (detecting camera shakes), but it seems very representative:

    The arrows indicate how the current image differs to the previous one;
    The entire frame is split into macroblocks (larger than 16×16, however);
    The difference for each block, compared to the previous image, is a movement vector;
    As you see, most macroblocks (white arrows) follow the common pattern, and therefore they can be encoded by only applying a transposition matrix to a previous frame.
    However, there are some blocks (red arrows) do not comply with the common pattern, and therefore they must be encoded as-is.
    Of course, if everything is red, there’s no choice other than encoding the entire frame as-is.

    0

    Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
    Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
    Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật