Install & Upgrade Specifications Setup Streaming Local/FTP File HLS HTML Web Video RTMP SRT DVB MPEG-TS MPEG-DASH Blackmagic DeckLink Newtek NDI Webcam & Screen IP Camera Advanced Settings Seamless Streaming Multi-bitrate Video Codecs NVIDIA GPU Intel GPU NETINT VPU Video Overlay

IPTV OTT Encoding & Streaming

HTTP Live Streaming (HLS) Protocol

What is HTTP Live Streaming (HLS)?

Apple HLS HTTP Live Streaming (HLS) is an HTTP-based adaptive bitrate streaming protocol developed by Apple Inc., and is widely supported by most media players, web browsers, and mobile devices. HLS is the industry standard for OTT streaming and broadcast applications.

HLS Segment-Based Streaming Architecture

HLS divides video content into small segments and delivers them through standard HTTP web servers. Viewers download these segments on-demand, allowing playback to begin immediately without waiting for the entire file to download. This segment-based approach enables adaptive bitrate streaming and improved user experience across different network conditions.

Stream from 3rd Party HLS Server

Consuming External HLS Streams

Select http as the source type and enter the HTTP or HTTPS URL of the m3u8 playlist as the source. For example: https://my.videosite.com/live/playlist.m3u8

Limitations with Protected Video Platforms

HLS links in video websites like YouTube and Twitch are usually obfuscated and protected to prevent user extraction. To stream from a YouTube or Twitch video page, try yt-dlp instead.

Stream HLS to Handheld Devices (Android and iOS)

HLS Output Architecture

Note that IPVTL does not directly output HLS streams. Instead, it generates HLS playlist files (.m3u8) and segment files (either MPEG-TS or CMAF fragmented MP4 format) to your local disk. These files can then be served by a web server such as Nginx, Apache, or Microsoft IIS to deliver HLS to end-user players and browsers. This architecture provides flexibility and scalability for large-scale streaming.

IVPTL output HLS

HLS File Structure and Locations

On Windows, the default output playlist file is C:\media\ipvt_ch#.m3u8. Segment files are generated in C:\media\ipvt_ch#-##.ts or C:\media\ipvt_ch#-##.m4s format. You can modify the Target URL to change it to your preferred folder and filename. Ensure these files are placed in your web server's publish folder for access and download.

HLS Playlist and Segment Parameters

Advanced HLS options can be configured in the channel's advanced format settings, including segment format and duration, playlist entry size, playlist base URL for internet clients, and master playlist filename. These settings control the streaming characteristics and compatibility with different players and networks.

IPVTL HLS Config

Best Practice: Setting up HLS with Nginx

  1. Install Nginx, for example to C:\nginx.
  2. In the C:\nginx directory, create a folder named media to serve as the virtual root directory for HLS content.
  3. In the C:\nginx\media directory, create a folder named hls to store the m3u8 and segment files.
  4. In IPVTL, configure the channel output file as C:\nginx\media\hls\stream.m3u8.
  5. Edit nginx.conf, and in the http{} block under server{}, add a location{} block for HLS as shown below:
http {
  ...
  server {
    ...
    location /hls {
      types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts; # or "video/mp4 mp4 m4s" if using CMAF;
      }
      root media;
      add_header Cache-Control no-cache;
    }
    ...
  }
  ...
}

Accessing HLS Stream via Nginx

Once both Nginx and the IPVTL channel start successfully, the HLS stream will be accessible at http://<your-web-server>/hls/stream.m3u8. This URL can be used in any compatible media player including VLC, iOS devices, Android devices, and web-based players.

HLS Adaptive Bitrate Streaming (ABR)

Understanding Adaptive Bitrate Technology

Adaptive bitrate (ABR) streaming is a technique that encodes the source content at multiple bitrates. Clients can dynamically adapt in real-time to provide optimal quality for each user. ABR considers network conditions, screen size, and device capabilities, and adjusts dynamically to changes in available bandwidth and device resources. This technology significantly improves user experience by preventing buffering and maximizing video quality.

Configuring Multiple Bitrate Profiles

To configure HLS adaptive bitrate streaming, follow the instructions in the multi-bitrate section. If multiple bitrate profiles are configured, separate playlists will be generated for each profile, such as 1080p.m3u8, 720p.m3u8, and 360p.m3u8. Additionally, a master playlist will be generated with links to all variants:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=2000000,RESOLUTION=1920x1080
1080p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1200000,RESOLUTION=1280x720
720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=800000,RESOLUTION=640x360
360p.m3u8

Master Playlist Publication

The master playlist, along with each profile playlist, should be published to the web server for content delivery. Media players will automatically select the appropriate bitrate based on available bandwidth and device capabilities.

Live Stream with Time Shifting

Implementing Live Stream Recording and Time-Shifting

With IPVTL HLS output capabilities, you can implement live stream recording or time-shifting to allow viewers to watch live content at a later time. This feature is valuable for broadcasting content that viewers might miss during the initial air time.

Two-Channel Time-Shift Architecture

To create live stream with time shifting, you will need 2 channels for each video program. One for original video storage and the other for time-shifted playback. Configure the 1st channel with HLS output, and the 2nd channel streaming from the 1st channel.

Time-Shift Buffer Configuration

In the 1st channel, configure HLS Segment Length and Playlist Entry Size to match timeshift duration you want. For example, a 3-second segment length and a 1200-entried playlist results in about 1 hour of time-shifted content (3s x 1200 = 3600s = 1 hour). Adjust these values based on your storage capacity and desired time-shift window.

Playback Source Configuration

In the 2nd channel, configure the streaming source to point to the 1st channel's HLS output. For example, c:\media\ipvt_ch1.m3u8. It is important to navigate to advanced format settings > Custom Options > Source Options, and enter "-live_start_index 0" in it. This ensures that the 2nd channel always starts streaming from the beginning of the playlist, allowing viewers to watch the live stream with time shifting capability from the beginning of the buffer.

HLS Encryption Options

DRM Protection with AES-128 Encryption

You can also enable CENC (Common Encryption) support using the ISO/IEC 23001-7 standard with AES-CBC encryption for DRM-protected systems. To do this, you need an AES key and a metadata file. The key file should contain 16 octets of key data in binary format, which can be generated using the OpenSSL command like this:

$ openssl rand -hex 16 | xxd -r -p > stream.key

Encryption Metadata Configuration

The metadata file should be in text format and contain the following information:

AES key URI (to be placed in the playlist for internet clients)
AES key file path (to be read from the local folder for segment encryption)
AES initialization vector (IV) in hexadecimal format (optional, used as segment sequence number)

Example Encryption Setup

Here's an example metadata file for encryption configuration:

http://your.website.com/hls/stream.key
d:\media\hls\stream.key
0123456789ABCDEF0123456789ABCDEF

Enabling Stream Encryption

Enter the path to the metadata file in the AES128 Encryption Key Info File field to enable stream encryption. This encrypts all HLS segments ensuring secure transmission.

Security Note: The AES key is managed externally and can be updated periodically to enhance streaming security. Implement key rotation policies for production environments.

Enhanced HLS Features and Integration

Hardware Acceleration for HLS Encoding

For optimal performance with HLS streaming, enable hardware acceleration:

Complementary Streaming and Content Features

Enhance your HLS streaming with additional capabilities: