Multimedia System ApplicationUnit 910 min read
Multimedia Networking & Streaming: Protocols, QoS, CDN, Adaptive Bitrate
Unit 9 of Multimedia System Application covers how multimedia content travels across networks—streaming protocols (RTMP, HLS, DASH), Quality of Service (QoS) techniques, Content Delivery Networks (CDNs), adaptive bitrate streaming, and real-world deployments in apps like YouTube, Daraz, and eSewa.
Core Concepts
1. Multimedia Networking Basics
Multimedia networking involves transmitting audio, video, and interactive content over networks (LAN/WAN) with minimal delay and high quality. Unlike static files, multimedia requires:
- Low latency (delay < 2s for streaming)
- High bandwidth (e.g., 4K video needs ~25 Mbps)
- Error resilience (lost packets degrade quality less than text)
Why it matters: Without proper networking, video calls (Zoom), live sports (Nepali Premier League), or e-learning (TU’s online classes) would freeze or buffer.
2. Streaming Protocols: How Content Flows
Streaming delivers content without full downloads. Key protocols:
| Protocol | Use Case | How It Works | Example Apps |
|---|---|---|---|
| RTMP | Live streaming (low latency) | Pushes data in real-time (TCP-based, no buffering) | OBS Studio, Facebook Live |
| HLS | Adaptive streaming (Apple) | Splits video into small HTTP chunks (MP4), adjusts quality dynamically | YouTube, Netflix |
| DASH | Standardized adaptive streaming | Uses MPEG-DASH (ISO standard), supports multi-bitrate, multi-codec | Amazon Prime Video, Ncell TV |
| WebRTC | Real-time peer-to-peer (P2P) | Enables direct browser-to-browser video calls (used in WebSocket) | Google Meet, Pathao’s driver app |
Worked Example: Daraz Live Streaming Daraz sellers use RTMP to broadcast product demos. The workflow:
- Seller’s phone → OBS Studio (encodes video to RTMP).
- RTMP stream → Daraz’s CDN (distributed servers).
- CDN delivers HLS chunks to users’ browsers.
- Browser (using
hls.js) reassembles chunks into playable video.
Why HLS? Daraz’s global users have varying internet speeds; HLS dynamically switches between 720p (2 Mbps) and 480p (500 Kbps).
3. Quality of Service (QoS) for Multimedia
QoS ensures multimedia traffic gets priority over emails/files. Techniques:
- Traffic Shaping: Limits bandwidth for non-critical traffic (e.g., NTC throttles torrent downloads during peak hours).
- Prioritization: Marks packets with DSCP (Differentiated Services Code Point) to bypass queues.
- Buffering: Pre-loads data (e.g., YouTube buffers 5–10s ahead).
Mermaid Diagram: QoS in a Router
Real-World Example: Ncell’s 4G QoS During Tihar festivals, Ncell uses QoS to:
- Prioritize WhatsApp calls (VoIP) over file downloads.
- Reduce latency for Pathao rides (real-time GPS updates).
4. Content Delivery Networks (CDNs)
A CDN is a network of servers that cache content closer to users. How it works:
- User requests
https://daraz.com/live. - DNS redirects to the nearest CDN edge server (e.g., in Kathmandu instead of Singapore).
- Server delivers pre-cached video chunks.
Advantages:
- Lower latency (faster load times).
- Reduced server load (origin server handles fewer requests).
- Scalability (handles traffic spikes, e.g., NEPSE stock updates).
Disadvantages:
- Cost: CDNs like Cloudflare or Akamai charge per GB.
- Stale content: Cached data may not be real-time (e.g., live cricket scores).
Worked Example: eSewa’s Payment Streaming When you pay via eSewa:
- Your request → eSewa’s origin server (hosted in Nepal).
- CDN caches frequently accessed pages (e.g., login screen) in Pokhara/Kathmandu nodes.
- During Dashain sales, CDN ensures smooth checkout even if origin server is slow.
5. Adaptive Bitrate Streaming (ABR)
ABR dynamically adjusts video quality based on network conditions. How it works:
- Player checks bitrate (e.g., 1.5 Mbps).
- If speed drops to 500 Kbps, switches to lower-resolution chunks.
- If speed improves, switches back to 4K.
Algorithms Used:
- Bitrate Ladder: Pre-defined quality levels (e.g., 240p, 360p, 720p, 1080p).
- Buffer Management: Maintains 5–30s buffer to avoid stalls.
Real-World Example: YouTube in Kathmandu
- Slow connection (2 Mbps): Plays 720p.
- Fast connection (10 Mbps): Plays 1080p.
- Mobile data (1 Mbps): Switches to 360p to avoid buffering.
6. Multimedia over Mobile Networks
Mobile streaming faces challenges:
- Limited bandwidth (4G: ~50 Mbps vs. 5G: ~1 Gbps).
- Handover delays (switching between cell towers).
- Battery drain (continuous buffering).
Solutions:
| Challenge | Solution | Example |
|---|---|---|
| High latency | 5G + Edge Computing | Ncell’s 5G live cricket streaming |
| Battery drain | Low-power codecs (AV1, VP9) | YouTube’s VP9 videos |
| Handover delays | Seamless Wi-Fi calling | WhatsApp calls in Kathmandu |
7. Security in Multimedia Streaming
Threats:
- Man-in-the-Middle (MITM): Intercepts streams (e.g., hacking eSewa’s payment video calls).
- DDoS Attacks: Overloads servers (e.g., targeting NEPSE’s live trading streams).
- Piracy: Unauthorized redistribution (e.g., leaked Nepali Premier League matches).
Solutions:
- HTTPS + TLS: Encrypts streams (e.g., YouTube uses TLS 1.3).
- DRM (Digital Rights Management): Protects premium content (e.g., Netflix’s Widevine).
- Watermarking: Embeds user IDs in streams (used by Ncell TV).
Mermaid Diagram: Secure Streaming Pipeline
sequenceDiagram
User->>CDN: Requests Video (HTTPS)
CDN->>Origin: Checks DRM License
Origin-->>CDN: Returns Encrypted Chunks
CDN-->>User: Streams via TLS
User->>Player: Decrypts with WidevineIn the Real World
YouTube (Google)
- Idea Used: DASH + ABR
- How: YouTube’s adaptive bitrate uses MPEG-DASH to switch between 240p to 8K based on your internet speed. During load shedding, it drops to 360p to avoid buffering.
- Nepal Tie-In: Students in Kathmandu experience lower bitrates than in Thamel due to ISP throttling.
Pathao (Ride-Hailing App)
- Idea Used: WebRTC + QoS
- How: Pathao uses WebRTC for real-time driver-passenger voice calls. During traffic jams, QoS ensures the call stays clear while GPS updates (low-latency UDP) take priority over map tiles (TCP).
- Worked Example: If your Pathao driver’s call drops, it’s likely due to high packet loss in Kathmandu’s congested 4G network.
Ncell TV (Telecom)
- Idea Used: HLS + CDN
- How: Ncell TV streams IPTV using HLS for adaptive playback. During IPL matches, their CDN in Lalitpur caches popular channels to reduce latency for subscribers.
- Nepal Challenge: Rural areas (e.g., Darchula) suffer from high latency due to limited fiber backhaul.
eSewa (Digital Payments)
- Idea Used: HTTPS + CDN
- How: When you transfer money, eSewa’s CDN serves the payment page from the nearest server (e.g., Kathmandu instead of Singapore). TLS 1.3 encrypts your transaction to prevent MITM attacks.
- Real Scenario: During Dashain, eSewa’s CDN prevents crashes by distributing load across Pokhara, Biratnagar, and Kathmandu nodes.
Exam Tip
What Examiners Look For
- Protocol Differences: Always compare RTMP (live) vs. HLS/DASH (adaptive). Mention latency vs. scalability trade-offs.
- QoS Techniques: Link to real networks (e.g., "NTC uses QoS to prioritize VoIP over torrents").
- CDN Workflow: Draw a 3-step diagram (user → edge server → origin).
- ABR Math: If asked to calculate bitrate switches, use:
- Buffer formula:
Buffer Size (s) = (Bitrate × 2) / (Network Speed). - Example: For a 5 Mbps video on a 1 Mbps connection, buffer needed =
(5 × 2) / 1 = 10s.
- Buffer formula:
- Security: Pair DRM with TLS in answers (e.g., "Netflix uses Widevine DRM over HTTPS").
Common Pitfalls
- Confusing RTMP (live) with HLS (VOD): RTMP is unidirectional; HLS is chunked HTTP.
- Ignoring Mobile Constraints: Always mention 4G vs. 5G or battery impact if asked about mobile streaming.
- Overlooking CDN Costs: Examiners may ask why a company doesn’t use CDN (answer: "Small businesses like local Daraz sellers may skip CDNs due to high costs").
Practice Question with Solution
Question: Explain how WhatsApp video calls use multimedia networking concepts. Include protocols, QoS, and security.
Solution:
- Protocol: WhatsApp uses WebRTC (peer-to-peer) for real-time video. If P2P fails, it falls back to Google’s CDN.
- QoS: During calls, WhatsApp marks packets with DSCP=46 (EF) to bypass ISP queues (e.g., Ncell prioritizes calls over downloads).
- Adaptive Bitrate: Switches between 360p (low data) and 720p (high data) based on network speed.
- Security:
- SRTP (Secure RTP) encrypts audio/video.
- TLS 1.2 secures signaling (call setup).
- Real-World Example: In Kathmandu traffic, if your call buffers, it’s due to high packet loss (QoS helps but can’t fix ISP congestion).
Visual:
sequenceDiagram
User1->>User2: WebRTC Offer (SDP with ICE candidates)
User2->>User1: WebRTC Answer (SDP + DTLS setup)
User1->>CDN: Fallback Request (if P2P fails)
User1->>User2: SRTP-Encrypted Stream (DSCP=46)
User2->>User1: ACK (with jitter buffer status)
Note over User1,User2: Kathmandu ISP: Packet loss → Buffering
Note over User1,CDN: Widevine DRM check (if premium content)Based on the TU BIM syllabus for Multimedia System Application (IT273), unit 9.
Discussion
Loading…