Professional Documents
Culture Documents
ch06f Mpeg Compression
ch06f Mpeg Compression
1
Chapter 6
Fundamentals of Digital Video
Part 6
MPEG Compression
Streaming Video and Progressive
Download
2
In this lecture, you will learn:
• Basic concepts of MPEG compression
• Types of MPEG
• Applications of MPEG
4
What Happend to MPEG-3?
• NOT MP3 (which is audio format)
5
MPEG-1
• Video quality comparable to VHS
7
MPEG-4
• Newer standard of MPEG family
8
MPEG-1 and MPEG-2
9
Properties of Typical Video
• Neighboring frames are very similar
– This property is called Temporal redundancy.
10
Basic Ideas of Motion Compensation
1. An video frame image is read in as a
reference frame
2. Read the next video frame image
3. Compare the image content between this
current frame (target frame) with the
reference frame
– one block of pixels at a time
11
Comparing Reference and Target Frames
Case 1:
If a pixel block is identical at the same location
in both frames:
– No need to encode the target frame's
– Just save an instruction to refer to the block in the
reference image—requires less space than
encoding the whole pixel block
12
Comparing Reference and Target Frames
Case 2:
If a pixel block at the same location in both
frames is not identical:
– Search for the reference image for a match
(because the content may be moved to another
location)
• Case 2a: No match is found
• Case 2b: A match is found
13
Case 2a: No Match is Found
• The whole pixel block is encoded
14
Case 2b: A Match is Found
• The displacement information of the block is
saved.
• Displacement information:
– A 2-dimensional value, indicating how much the block
moves horizontally and vertically from the reference
frame to the target frame
– Called motion vector
– Much smaller size than encoding the whole pixel
blocks
(thus the saving in file size)
15
Illustration of the Ideas
16
Illustration of the Ideas
17
Illustration of the Ideas
The red color highlights the pixel blocks that are encoded.
The whole frame of a reference frame is encoded. No saving in file size.
18
Illustration of the Ideas
19
Illustration of the Ideas
Each pixel block in Frame 2 is searched in Frame 1
trying to find a match.
20
Illustration of the Ideas
Each pixel block in Frame 2 is searched in Frame 1
trying to find a match.
The blue color highlights some pixel blocks that are found in Frame 1.
The yellow color highlights some pixel blocks that are found in Frame 1 (but
later in the process they are found in the next reference frame.)
21
Illustration of the Ideas
22
Illustration of the Ideas
Each pixel block in Frame 3 is searched in Frame 1
trying to find a match.
23
Illustration of the Ideas about Motion Vector
Frame 1 Frame 2
24
Illustration of the Ideas about Motion Vector
Frame 1 Frame 2
25
Illustration of the Ideas about Motion Vector
Let's arrange the frames vertically to see the displacement easier
Frame 1
Frame 2
26
Illustration of the Ideas about Motion Vector
Let's arrange the frames vertically to see the displacement easier
Frame 1
Frame 2
27
Illustration of the Ideas about Motion Vector
Let's arrange the frames vertically to see the displacement easier
Frame 1
Frame 2
28
Illustration of the Ideas about Motion Vector
Let's arrange the frames vertically to see the displacement easier
Frame 1
Frame 2
30
31
Motivation of Understanding GOP
To understand:
• the impact of the GOP parameters on video file size and quality
• why some video editing programs may not support frame accurate
editing of MPEG
32
33
Group of Pictures (GOP)
• Specifies the grouping structure of frames
• Example:
– DVD-compliant MPEG-3: N = 15
– HDV: N = 15
35
I-frames
• Stands for Intraframes
37
P-frames
• Stands for predicted frames
39
Example GOP
DVD-compliant MPEG-2:
I B B P B B P B B P B B P B B
N = 15
i.e., number of frames in a GOP = 15
40
Example GOP
DVD-compliant MPEG-2:
I B B P B B P B B P B B P B B
M=3
i.e., number of frames between non-B-frames plus one = 2+1 = 3
41
Revisit the 4-frame video
example
Suppose N = 15, M = 3
42
Example GOP:
N = 15, M = 3
I B B P B B P B B P B B P B B
43
Example GOP:
N = 15, M = 3
I B B P B B P B B P B B P B B
44
Example GOP:
N = 15, M = 3
I B B P B B P B B P B B P B B
• Rationales:
– A MPEG-2 consists of a repeating GOP structure
– Each GOP contains one I-frame
– I-frames are the least compressed among the three
types of frames, and thus take up more storage space
– Shorter GOP means more GOPs in a MPEG-2
– More GOPs means more I-frames in a MPEG-2
48
How GOP Settings Affect Picture Quality
• Rationales:
– I-frames are compressed based on the frame
information, rather than predicted from other
frames
49
How GOP Structure Affects Frame-
Accurate Video Editing
• Some video editing programs may not support
frame-accurate video editing of MPEG-2 because
it is more complex than other video format
• Rationales:
– The information for a P-frame depends on the
information of its previous I-frame.
– A B-frame depends on the information of its previous
and subsequent I- or P-frames.
– Thus, it is more complex to trim out frames from a
MPEG-2 than other video format.
50
Applications of MPEG-4
• Cover a wide range of data rate
53
Two Ways of Playing Video
• Play from disk
• Play over a network
54
Play from Disk
• An entire clip needs to be on disk before it can
be played
55
Play over a Network
• The video can be played while it is being
downloaded
• Streaming video
• Progressive download
56
Streaming Video
• Play video as soon as enough data has arrived
• Examples:
– Streaming QuickTime
– Real Video
– Window Media Video (WMV)
57
Streaming Video
• Require a streaming server to stream video
• Example:
– QuickTime fast-start
• Created by saving the QuickTime movie as self-
contained using QuickTime Pro
59
Review Questions
Note to instructor:
Depending on your preference, you may want to go
over the review questions at the end of this lecture as
an instant review or at the beginning of next lecture to
refresh students' memory of this lecture.
60
Review Question
True/False: The MP3 audio is a MPEG-3.
61
Review Question
___ provides a video quality comparable to VHS
and is the file format for VCD.
A.MPEG-1
B.MPEG-2
C.MPEG-3
D.MPEG-4
62
Review Question
___ support the DVD-video, HDV, and HDTV
standards.
A.MPEG-1
B.MPEG-2
C.MPEG-3
D.MPEG-4
63
Review Question
True/False: A typical MPEG-2 consists of a
repeating GOP structure.
64
Review Question
Motion compensation is a key technique in ___.
A.asymmetric
B.lossless
C.lossy
D.spatial
E. temporal
65
Review Question
___ is encoded using only the information
within that frame.
A.B-frame
B.I-frame
C.P-frame
66
Review Question
___ is encoded using only the previous I- or P-
frame as the reference frame.
A.B-frame
B.I-frame
C.P-frame
67
Review Question
___ is encoded using the previous and
subsequent I- and/or P-frame as the reference
frames.
A.B-frame
B.I-frame
C.P-frame
68
Review Question
___ is the least compressed among the three
frame types.
A.B-frame
B.I-frame
C.P-frame
69
Review Question
The N parameter of the GOP refers to ___.
70
Review Question
The M parameter of the GOP refers to ___.
71