Media Compression.

Slides:



Advertisements
Similar presentations
Introduction to H.264 / AVC Video Coding Standard Multimedia Systems Sharif University of Technology November 2008.
Advertisements

T.Sharon-A.Frank 1 Multimedia Compression Basics.
MPEG: A Video Compression Standard for Multimedia Applications Václav Hlaváč CTU Prague, Initial material were slides of Didier.
Video Compression - MPEG
Chapter 6 Review.
Basics of MPEG Picture sizes: up to 4095 x 4095 Most algorithms are for the CCIR 601 format for video frames Y-Cb-Cr color space NTSC: 525 lines per frame.
NUS.SOC.CS Roger Zimmermann (based on slides by Ooi Wei Tsang) MPEG + RTP.
1 Video Coding Concept Kai-Chao Yang. 2 Video Sequence and Picture Video sequence Large amount of temporal redundancy Intra Picture/VOP/Slice (I-Picture)
Audiovisual digital documents Adolf Knoll National Library of the Czech Republic
Source Coding for Video Application
NUS.SOC.CS Roger Zimmermann (based in part on slides by Ooi Wei Tsang) Media Compression.
T.Sharon-A.Frank 1 Multimedia Size of Data Frame.
CS :: Fall 2003 MPEG-1 Video (Part 1) Ketan Mayer-Patel.
ATSC Digital Television
An Introduction to H.264/AVC and 3D Video Coding.
Multimedia Compression John Hall SMDC Training June, 2006.
+ Video Compression Rudina Alhamzi, Danielle Guir, Scott Hansen, Joe Jiang, Jason Ostroski.
1 Digital Video. 2  Until the arrival of the Pentium processor, in 1993, even the most powerful PCs were limited to capturing images no more than 160.
NUS.SOC.CS Roger Zimmermann (based in part on slides by Ooi Wei Tsang) Media Compression.
ECE472/572 - Lecture 12 Image Compression – Lossy Compression Techniques 11/10/11.
1 Image Compression. 2 GIF: Graphics Interchange Format Basic mode Dynamic mode A LZW method.
MPEG MPEG-VideoThis deals with the compression of video signals to about 1.5 Mbits/s; MPEG-AudioThis deals with the compression of digital audio signals.
Multimedia Data Video Compression The MPEG-1 Standard
MPEG-1 and MPEG-2 Digital Video Coding Standards Author: Thomas Sikora Presenter: Chaojun Liang.
MPEG: (Moving Pictures Expert Group) A Video Compression Standard for Multimedia Applications Seo Yeong Geon Dept. of Computer Science in GNU.
Video Compression Techniques By David Ridgway.
Irfan Ullah Department of Information and Communication Engineering Myongji university, Yongin, South Korea Copyright © solarlits.com.
Q G Dave MacCarn, WGBH. Q G From Analog to Digital to HD  Explosion of new formats with the start of standard-definition digital video and an even broader.
Videos Mei-Chen Yeh. Outline Video representation Basic video compression concepts – Motion estimation and compensation Some slides are modified from.
Image Processing and Computer Vision: 91. Image and Video Coding Compressing data to a smaller volume without losing (too much) information.
Recording Options: Codecs and Containers 1 Dave MacCarn, WGBH.
8. 1 MPEG MPEG is Moving Picture Experts Group On 1992 MPEG-1 was the standard, but was replaced only a year after by MPEG-2. Nowadays, MPEG-2 is gradually.
NUS.SOC.CS Roger Zimmermann (based in part on slides by Ooi Wei Tsang) Media Compression.
Compression video overview 演講者:林崇元. Outline Introduction Fundamentals of video compression Picture type Signal quality measure Video encoder and decoder.
NUS.SOC.CS5248 Ooi Wei Tsang Systems Support for Continuous Media OOI WEI TSANG.
MPEG-1Standard By Alejandro Mendoza. Introduction The major goal of video compression is to represent a video source with as few bits as possible while.
MPEG.
NUS.SOC.CS Roger Zimmermann (based in part on slides by Ooi Wei Tsang) Rate Adaptations.
JPEG Image Compression Standard Introduction Lossless and Lossy Coding Schemes JPEG Standard Details Summary.
MPEG CODING PROCESS. Contents  What is MPEG Encoding?  Why MPEG Encoding?  Types of frames in MPEG 1  Layer of MPEG1 Video  MPEG 1 Intra frame Encoding.
Q G Boston Public Television Quality Workshop 1 Dave MacCarn, WGBH.
6/9/20161 Video Compression Techniques Image, Video and Audio Compression standards have been specified and released by two main groups since 1985: International.
1 Introduction to Video Compression תשס"ט – 2009 דחיסת מולטימדיה – הנדסת מערכות תקשורת Part A Introduction to Video Compression תשס"ט – 2009 דחיסת מולטימדיה.
MPEG Video Coding I: MPEG-1 1. Overview  MPEG: Moving Pictures Experts Group, established in 1988 for the development of digital video.  It is appropriately.
Or, how to make it all fit! DIGITAL VIDEO FILES AND COMPRESSION STANDARDS.
H. 261 Video Compression Techniques 1. H.261  H.261: An earlier digital video compression standard, its principle of MC-based compression is retained.
Introduction to H.264 / AVC Video Coding Standard Multimedia Systems Sharif University of Technology November 2008.
Media Compression.
JPEG Compression What is JPEG? Motivation
Media Compression.
Video Basics.
Multimedia Outline Compression RTP Scheduling Spring 2000 CS 461.
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
MPEG + RTP.
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
JPEG.
Digital TV..
Data Compression.
Video Compression - MPEG
FINAL YEAR PROJECT Presentation Review :2 Shree Swami Atmanand Saraswati Institute Of Technology.
HTML5 Level II Session II
ELE 488 Fall 2006 Image Processing and Transmission ( )
Research Topic Error Concealment Techniques in H.264/AVC for Wireless Video Transmission Vineeth Shetty Kolkeri EE Graduate,UTA.
CIS679: MPEG MPEG.
ENEE 631 Project Video Codec and Shot Segmentation
Standards Presentation ECE 8873 – Data Compression and Modeling
Chap 3: Encoding Video Content
Digital Video Faraz Khan.
MPEG-1 MPEG is short for the ‘Moving Picture Experts Group‘.
MPEG-1 MPEG is short for the ‘Moving Picture Experts Group‘.
Presentation transcript:

Media Compression

You are Here Encoder Decoder Middlebox Sender Receiver Network NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Why compress? “Bandwidth Not Enough” “Disk Space Not Enough” Size of Uncompressed DVD Movie = NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Why compress? “Bandwidth Not Enough” “Disk Space Not Enough” Size of Uncompressed DVD Movie = (720 x 576) pixels x 3 bytes x 25 fps x 60 sec/min x 120 min = 208.6 GB NTSC: 29.97 fps (30/1.001); PAL 25 fps NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Optical Disc Formats (1) CD: ~650 MB VideoCD: codec MPEG-1 1X max. read speed: 1.5 Mb/s DVD: 4.7 (4.38) GB (single layer) 8.5 (7.92) GB (dual layer) Single and dual sided (up to 18 GB) 1X max. read speed: ~10 Mb/s Video codec: MPEG-2 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Optical Disc Formats (2) Blu-ray Capacity: 25 GB and 50 GB 1X speed: 36 Mb/s Video codec: VC-1, H.264, MPEG-2 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

JPEG Compression

Original Image (1153KB) 1:1

Original Image (1153KB) 3.5:1

Original Image (1153KB) 17:1

Original Image (1153KB) 27:1

Original Image (1153KB) 72:1

Original Image (1153KB) 192:1

Compression Ratio Quality Size Ratio Raw TIFF 1153KB 1:1 Zipped TIFF 1.2:1 Q=100 331KB 3.5:1 Q=70 67KB 17:1 Q=40 43KB 27:1 Q=10 16KB 72:1 Q=1 6KB 192:1 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Magic of JPEG Throw away information we cannot see, i.e., based on human visual system: Color information “High frequency signals” Rearrange data for good compression Use standard compression algorithms NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Discard color information Y YUV is also known as LUV or YCbCr V U NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Color Sub-sampling The subsampling scheme is commonly expressed as a three part ratio (e.g. 4:2:2). The parts are (in their respective order): Luma (Y) horizontal sampling reference (originally, as a multiple of 3.579 MHz in the NTSC television system). Cr (U) horizontal factor (relative to first digit). Cb (V) horizontal factor (relative to first digit), except when zero. Zero indicates that Cb horizontal factor is equal to second digit, and, in addition, both Cr and Cb are subsampled 2:1 vertically. Zero is chosen for the bandwidth calculation formula to remain correct. To calculate required bandwidth factor relative to 4:4:4, one needs to sum all the factors and divide the result by 12. NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Color Sub-sampling 4:4:4 4:2:0 4:2:2 4:1:1 420 is used by MPEG. 411 is used by DV. 4:2:2 4:1:1 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

4:2:2 Sub-sampling Y V U YUV is also known as LUV or YCbCr NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Original Image (1153KB) 4:2:0

Original Image (1153KB) “4:1:0”

Discrete Cosine Transform Demo NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Quantization DC 242 65 23 5 8 8 8 8 30 8 2 -54 -10 -4 -2 8 8 8 16 -6 -1 / = 13 6 3 5 8 8 16 32 1 2 1 -1 -2 8 16 32 64 Quantization Table AC NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Differential Coding 30 8 6 -1 2 1 25 3 2 1 4 27 3 2 1 4 30 8 6 -1 2 1 1 25 3 2 1 4 27 3 2 1 4 30 8 6 -1 2 1 -5 3 2 1 4 2 3 1 4 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Zig-zag ordering 27 3 2 1 4 27, 3, 2, 4, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Run-Length Encoding 27 3 2 1 4 27, 3, 2, 4, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 (27, 1) (3, 1) (2, 1), (4, 1), (1, 2), (0, 5), (1, 1), (0, 4) NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Idea: Motion JPEG Compress every frame in a video as JPEG DVD-quality video = 208.6GB Reduction ratio = 27:1 Final size = 7.7GB NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Video Compression

Original Frame 1 By (c) copyright 2006, Blender Foundation / Netherlands Media Art Institute / www.elephantsdream.org - Screenshot from "Elephants Dream" http://orange.blender.org/download, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=7395123 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Difference Between 2 Frames By (c) copyright 2006, Blender Foundation / Netherlands Media Art Institute / www.elephantsdream.org - Screenshot from "Elephants Dream" http://orange.blender.org/download, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=7395129 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Motion Compensated Difference By (c) copyright 2006, Blender Foundation / Netherlands Media Art Institute / www.elephantsdream.org - Screenshot from "Elephants Dream" http://orange.blender.org/download, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=7395132 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Temporal Redundancy NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Motion Estimation NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Bi-directional Prediction NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Motion Vectors NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

H.261 P-Frame I-Frame NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG-1 B-Frame NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG Frame Pattern (1) HDV GOP example NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG Frame Pattern (2) Example display sequence: IBBPBBP … Example encoding sequence: IPBBPBB NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Compression Ratio Frame Type Typical Ratio I 10:1 P 20:1 B 50:1 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Sequence sequence header: width height frame rate bit rate : NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

GOP: Group of Picture gop header: time : NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Picture pic header: number type (I,P,B) : NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Picture NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Slice NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Slice Slices are important in the handling of errors. If the bitstream contains an error, the decoder can skip to the start of the next slice. Having more slices in the bitstream allows better error concealment, but uses bits that could otherwise be used to improve picture quality (worse compression). NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Macroblock NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Block U Y 1 Macroblock = V NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Structure Summary NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

For I-Frame Every macroblock is encoded independently (“I-macroblock”) NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

For P-Frame Every macroblock is either I-macroblock a motion vector + error terms with respect to a previous I/P-frame (“P-macroblock”) NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

For B-Frame Every macroblock is either I-macroblock P-macroblock a motion vector + error terms wrt a future I/P-frame 2 motion vectors + error terms wrt a previous/future I/P-frame NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG-1/2 File Formats (Packetized) Elementary streams, ES & PES Program streams PS (reliable mediums, e.g., DVD) Transport streams TS (for lossy mediums, e.g., on-air broadcast) TS: *.ts *.m2t *.mpg MPEG-2 Elementary Encoder Packetizer Systems Layer MUX Transport Stream Video Source Audio MPEG encoded streams Data PES: *.m2v PES: *.m2a Flow chart © Manish Karir NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Review: MPEG structure ES, PS, TS: elementary stream, program stream, transport stream Sequence GOP: group of pictures Picture Slice Macroblock Block Important: Codec standards are essentially defined by their bitstreams! NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Container Formats Two common container formats: MPEG-2 TS (Transport Stream) ISO Base Media File Format (ISOBMFF) Container formats encapsulate the actual media streams and can contain various actual media types. E.g., TS is still used today with H.264 Container (ISOBMFF) Media data, e.g., video and audio (H.264) NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG Decoding (I-Frame) Entropy Decoding Dequantize 101000101 IDCT NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG Decoding (P-Frame) Entropy Decoding Dequantize 101000101 IDCT Prev Frame + NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

MPEG Decoding (B-Frame) Entropy Decoding Dequantize 101000101 Future Frame IDCT AVG Prev Frame + NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

There is much more … Half-pel motion prediction Skipped macroblock Different sizes of macroblocks Motion vectors across multiple frames etc. NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Codecs in Daily Life (1) MPEG Standards Bit-rate Usage MPEG-1 1.5Mbps VCD MPEG-2 3-45 Mbps DVD, SVCD, HDTV MPEG-4/ H.264/AVC Scalable, ½ MPEG-2 QuickTime, DivX, AVCHD, Cable TV, YouTube, … H.265/HEVC Scalable, ½ H.264 New generation, 4K content “H.266” Scalable, ½ H.265 Next generation, 8K content NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Codecs in Daily Life (2) © The Register, 16 Sep 2015, Nigel Whitfield NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Camcorders in Daily Life Tape-based: DV25 (MiniDV, DVCAM, DVCPRO) Capacity: 1 hour ~ 13 GB Bitrate: 25 Mb/s (user data) Color sampling: 4:1:1 Compression ratio: ~10:1 Disk/Flash-based: AVCHD 1.0 & 2.0 H.264: 24 Mb/s, HD, high compression NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Codec Comparison “M-JPEG” (e.g., DV) versus “MPEG” No “perfect” codec -> application dependent Compression Technique “M-JPEG” (I-frames only) “MPEG” (Temporal compression) Compression ratio Low (10:1 to 30:1) High (>100:1) Editing (frame-accurate) Easy Difficult Encoding/decoding complexity Symmetric Asymmetric Processing latency Low to Medium High Multi-generation loss Medium NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

High-Definition Standard by ATSC 18 different sub-formats 720p and 1080i are the most interesting 1280x720x60p, 1920x1080x60i (30p) 1080p is non-standard, but available 1.4 Gb/s raw bandwidth 10 – 20 Mb/s compressed (distribution, broadcast) 100 – 135 Mb/s compressed (pro tapes: DVCPROHD, HDCAM; for editing) NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Consumer HD HDV: MPEG-2 AVCHD: H.264 19 (720p) / 25 Mb/s (1080i) Tape format http://www.hdv-info.org AVCHD: H.264 5 to 25 Mb/s Hard disk format http://www.avchd-info.org/ NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Current Popular Codec: H.264 “Same quality at half the rate” Encoding complexity: ~4X How: Variable block size motion compensation Multiple reference frames Deblocking filter, … Also called MPEG-4 Part 10 or AVC or MPEG-4/AVC NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Current Codec: VP8 Google bought On2 Technologies in 2010, which developed VP8 Open-source license (H.264 needs to be licensed for use) Similar coding efficiency and quality as H.264 Uses the WebM file format NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Next Gen Codec: H.265/HEVC High Efficiency Video Coding (HEVC) “Same quality at half the rate” (over H.264/MPEG-4 AVC) Very high encoding complexity Supports progressive scanned frame rates and display resolutions from QVGA (320x240) up to 1080p (1920x1080) and Ultra HDTV (7680x4320) NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Next Gen Codecs: VP9, AV1 VP9 is an open and royalty free video coding format developed by Google. Successor to VP8. Supported by most web browsers (except Safari). Used by YouTube. Successor: AV1 NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Next Gen Codec: H.265 At WWDC 2017, Apple introduced two new camera formats that are included in iOS 11: HEVC and HEIF. Starting with iPhone 6, HEVC was the format for FaceTime. NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

H.265/HEVC Primary Changes Expansion of the pattern comparison and difference-coding areas from 16×16 pixel to sizes up to 64×64. Improved variable-block-size segmentation, improved "intra" prediction within the same picture. Improved motion vector prediction and motion region merging. Improved motion compensation filtering. An additional filtering step called sample-adaptive offset filtering. NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Deblocking Filter With heavy compression, blocking artifacts become visible. Deblocking filters are used in both H.264 and H.265. NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Hands-On Download source code, compile and play with ffmpeg mpeg_stat Video ‘Surfing_short.m2t’ from course web site (98 MB, HDV, transport stream) Try different MPEG-1/2 encoding parameter NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Impact on Systems Design How to package data into packets? How to deal with packet loss? How to deal with bursty traffic? How to predict decoding time? : NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)

Summary Compression removes data for which the human visual system is not sensitive. Current codecs are mostly based on DCT and motion compensation. Container formats (MPEG-2 TS, ISOBMFF) are important for system designers. Codec standards are essentially defined by their bitstreams. NUS.SOC.CS5248-2017 Roger Zimmermann (based in part on slides by Ooi Wei Tsang)