IT273 Multimedia System Application

Multimedia System ApplicationUnit 77 min read

Multimedia Compression: Techniques, Standards & Applications

Unit 7 of Multimedia System Application covers lossless/lossy compression, file formats (JPEG, MP3, H.264), quantization, entropy coding, and real-world streaming systems like YouTube and Ncell’s video-on-demand.

What is Multimedia Compression?

Multimedia compression reduces file sizes while preserving quality. Without compression, a 2-minute 1080p video would require ~1.5 GB of storage. Compression makes streaming (YouTube, Ncell TV) and storage (cloud, phones) feasible.

Why Compress?

  • Storage: Save space on devices (phones, hard drives).
  • Bandwidth: Faster downloads/uploads (e.g., Daraz product images).
  • Cost: Reduce server/storage costs (e.g., NTC’s video archives).

1. Lossless vs. Lossy Compression

mindmap
  root((Compression))
    Lossless
      "No data loss"
      "Used for text, spreadsheets"
      "Examples: ZIP, PNG"
    Lossy
      "Data discarded"
      "Used for audio/video"
      "Examples: JPEG, MP3"

Lossless Compression

  • How it works: Removes redundancy (e.g., repeating patterns in text).
  • Methods:
    • Run-Length Encoding (RLE): Replaces repeated sequences (e.g., AAAAA → 5A).
    • Dictionary Coding (LZW): Stores repeated phrases once (e.g., ZIP files).
    • Huffman Coding: Assigns shorter codes to frequent symbols (used in PNG, TIFF).

Example: Compressing a black-and-white fax (many repeated pixels).

Lossy Compression

  • How it works: Sacrifices quality for smaller files (e.g., discarding less noticeable details).
  • Methods:
    • Quantization: Reduces color depth (e.g., 24-bit RGB → 8-bit palette).
    • Discrete Cosine Transform (DCT): Converts images into frequency components (used in JPEG).
    • Psychovisual Models: Exploits human perception (e.g., ignoring high-frequency noise in audio).

Example: A JPEG photo at 80% quality loses some detail but saves 60% space.


2. Key Compression Techniques

A. Audio Compression (MP3, AAC)

flowchart TD
  A["Raw Audio"] --> B["Fourier Transform"]
  B --> C["Remove Inaudible Frequencies"]
  C --> D["Quantize Remaining Data"]
  D --> E["Encode with Huffman"]
  E --> F["MP3 File"]

How MP3 works:

  1. Filtering: Removes frequencies humans can’t hear (>16 kHz).
  2. Quantization: Reduces bit depth for less critical frequencies.
  3. Huffman Coding: Shortens common bit patterns.

Real-world use: Spotify, Ncell Music use MP3/AAC to stream songs efficiently.

B. Video Compression (H.264, H.265)

flowchart TD
  A["Video Frames"] --> B["Keyframe (I-frame)"]
  B --> C["Predictive Frames (P/B-frames)"]
  C --> D["Motion Estimation"]
  D --> DCT --> E["Quantization"]
  E --> F["Entropy Coding"]
  F --> G["H.264 File"]

How H.264 works:

  1. Keyframes (I-frames): Full frames (like a snapshot).
  2. Predictive Frames (P/B-frames): Store only changes (e.g., a moving car’s delta).
  3. Motion Compensation: Predicts movement between frames.

Example: YouTube’s adaptive bitrate switches between H.264/H.265 based on your internet speed.

C. Image Compression (JPEG, PNG)

Format Type Use Case Lossy? Transparency?
JPEG Lossy Photos, web images Yes No
PNG Lossless Logos, screenshots No Yes
GIF Lossless Simple animations No Yes

JPEG vs. PNG:

  • JPEG: Best for photos (uses DCT).
  • PNG: Best for graphics (uses RLE + LZW).

3. Real-World Applications

A. Streaming (YouTube, Ncell TV)

  • Problem: A 1-hour 4K video = ~100 GB uncompressed.
  • Solution: H.265 (HEVC) reduces it to ~5 GB while keeping near-original quality.
  • How it works:
    1. Server encodes video in multiple bitrates (720p, 1080p, 4K).
    2. Your device picks the best quality based on speed.
    3. Adaptive bitrate streaming (ABR) adjusts in real-time.

B. Mobile Apps (WhatsApp, Pathao)

  • WhatsApp: Uses WebP (Google’s format) for images to reduce data usage.
  • Pathao: Compresses driver location updates to save battery.

C. E-Commerce (Daraz, NEPSE)

  • Daraz: Compresses product images to <100 KB for faster loading.
  • NEPSE: Stores stock charts as PNG/SVG (scalable vector graphics) for crisp displays.

4. Worked Example: Compressing a Photo

Scenario: A 5 MB JPEG photo needs to fit in a WhatsApp message (max 16 MB).

Steps:

  1. Original: 5 MB, 24-bit color.
  2. Apply JPEG Compression:
    • Reduce quality to 70% → 1.2 MB.
    • Use progressive JPEG (loads in stages).
  3. Result: Photo fits in WhatsApp and loads faster.

5. Advantages and Disadvantages

Type Pros Cons
Lossless No quality loss Larger files
Lossy Smaller files Permanent quality loss
Huffman Efficient for text/data Complex to implement
DCT (JPEG) Great for photos Artifacts at low quality

6. Common Compression Standards

Standard Type Used For Example Files
JPEG Lossy Photos .jpg, .jpeg
MP3 Lossy Audio .mp3
H.264 Lossy Video .mp4, .mkv
ZIP Lossless Files/folders .zip
FLAC Lossless High-fidelity audio .flac

In the Real World

  1. YouTube: Uses H.264/H.265 + AAC to stream videos globally with minimal buffering. A 10-minute video might be 500 MB uncompressed but only 50 MB after compression.
  2. Ncell’s Video-on-Demand: Compresses movies to ~1 GB per hour (vs. 10 GB uncompressed) to save mobile data.
  3. Daraz Product Images: Compressed to <50 KB using WebP to load instantly on slow 3G networks.

Exam Tip

  • Define: Lossless vs. lossy compression (1 mark each).
  • Compare: JPEG vs. PNG (2 marks).
  • Apply: Calculate compression ratio (e.g., "A 10 MB file becomes 2 MB after compression. What’s the ratio?" → 5:1).
  • Diagrams: Draw a block diagram of MP3 compression or H.264 frame types (I/P/B-frames).
  • Real-world link: Always relate to streaming (YouTube), mobile apps (WhatsApp), or e-commerce (Daraz).

Key Formulas to Remember

  1. Compression Ratio = Original Size / Compressed Size
    • Example: 10 MB → 2 MB → 5:1 ratio.
  2. Bitrate = File Size / Duration (in bits per second).
    • Example: 50 MB video in 10 sec → 40 Mbps.

Visual Summary

mindmap
  root((Multimedia Compression))
    Lossless
      "RLE, LZW, Huffman"
      "No quality loss"
    Lossy
      "JPEG, MP3, H.264"
      "Quality trade-off"
    Applications
      "Streaming (YouTube)"
      "Mobile Apps (WhatsApp)"
      "E-commerce (Daraz)"
    Standards
      "JPEG (Images)"
      "MP3 (Audio)"
      "H.264 (Video)"

Based on the TU BIM syllabus for Multimedia System Application (IT273), unit 7.

Discussion

Loading…