DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • The Agent Protocol Stack: MCP vs. A2A vs. AG-UI
  • Understanding the Shifting Protocols That Secure AI Agents
  • Model Context Protocol Vs Agent2Agent: Practical Integration with Enterprise Data
  • Agentic Commerce: A Developer's Guide to Google's Universal Commerce Protocol (UCP)

Trending

  • Amazon Quick: AWS's Agentic Workspace, Explained for Engineers
  • Logging What AI Agents Do in Salesforce: A Simple One-Object Audit Framework
  • Building a High-Throughput Distributed Sequence Generator Using the Hi-Lo Algorithm
  • The Hidden Cost of AI Tokens: Engineering Patterns for 10x Resource Efficiency

HLS Streaming Protocol

A software engineer discusses the principles behind the HLS streaming protocol that's built on HTTP and allows for video/audio data transfer.

By 
sagar patel user avatar
sagar patel
·
Updated Jan. 17, 20 · Analysis
Likes (9)
Comment
Save
Tweet
Share
16.9K Views

Join the DZone community and get the full member experience.

Join For Free

HLS (HTTP Live Streaming)

HLS is an HTTP-based streaming protocol.

Before starting with the protocol, we need to understand the fundamentals of digital videos. Refer to the below link for a basic understanding of video components.

Reference: https://www.cisco.com/c/en/us/td/docs/solutions/Enterprise/Video/pktvideoaag.html

HLS works by breaking down a stream into a sequence of small packets. As the stream is played, the client selects a number of different alternative streams containing the same information encoded with a variety of data rates. It allows for streaming sessions to take data from various data rates.

At the start of a streaming session, HLS downloads one file with the extension M3U (and m3u8 if the UTF-8 encoding-character coded format is used). It contains the specific location of one or more media files. It is commonly used to point media players to audio and video sources.

An M3U file is a plain text file that specifies the locations of one or more media files.

Reference: https://www.lifewire.com/m3u-file-2621955

HLS uses HTTP-base transactions over TCP, unlike the RTP protocol transaction over UDP.

HTTP live streaming uses a web server (network protocol to distribute information over world wide web) to distribute streaming content. The primary function of a web server is to store, process, and deliver web pages or clients.

The server codifies and encapsulates input videos into the proper format for delivery. Videos are then prepared for distribution by segmenting them into different files. The video is thus transformed into fragmented and indexed files.

Audio/video data is encapsulated and formated as a PES packet (packetized elementary stream (actual video.audio data), which is then bound with the TS packet.) This is later attached with MPEG transport stream.

Don't confuse MJPEG with MPEG2TS. MJPEG is a codec that has video information and MPEG2TS is a container that enables the transfer of stream data.

NOTE:

Codec - "A codec is a method for encoding and decoding data and more specifically, a protocol for compressing data, especially video."

Container - "The container takes care of packaging, transport, and presentation. The container is usually represented by a file extension. For example, the MPEG4 container is usually represented by a .mp4 file type."

The MPEG transport stream (mjpeg2ts) is a standard digital container format for transmission and storage of audio and video data. It's used for broadcast systems such as digital video broadcasting (ATSC and IPTV).

Reference:https://en.wikipedia.org/wiki/MPEG_transport_stream

Block diagram:

References

  • https://developer.apple.com/streaming/

  • https://www.cisco.com/c/en/us/td/docs/solutions/Enterprise/Video/pktvideoaag.html

Protocol (object-oriented programming)

Opinions expressed by DZone contributors are their own.

Related

  • The Agent Protocol Stack: MCP vs. A2A vs. AG-UI
  • Understanding the Shifting Protocols That Secure AI Agents
  • Model Context Protocol Vs Agent2Agent: Practical Integration with Enterprise Data
  • Agentic Commerce: A Developer's Guide to Google's Universal Commerce Protocol (UCP)

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook