IPTV OTT Encoding & Streaming
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 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.
Stream from 3rd Party HLS Server
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
Note: 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)
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.
On Windows, the default output playlist file is C:\media\ipvt_ch#.m3u8.
Segment files are generated in C:\media\ipvt_ch#-##.ts. 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.
Additional HLS settings, such as segment duration, playlist entry count, and encryption (DRM), are available in the Advanced HLS Configuration section below.
Best Practice: Setting up HLS with Nginx
- Install Nginx, for example to C:\nginx.
- In the C:\nginx directory, create a folder named media to serve as the virtual root directory for HLS content.
- In the C:\nginx\media directory, create a folder named hls to store the m3u8 and segment files.
- In IPVTL, configure the output file as C:\nginx\media\hls\stream.m3u8.
- 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;
}
...
}
...
}
Once both Nginx and the IPVTL channel start successfully, the HLS stream will be accessible
at http://<your-web-server>/hls/stream.m3u8.
HLS Adaptive Bitrate Streaming
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.
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, for example:
#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
The master playlist, along with each profile playlist, should be published to the web server for content delivery.
Advanced HLS Configuration
When streaming to HLS format, you can configure several parameters for the output playlist and segment files, including segment format and duration, playlist entry count, playlist base URL for internet clients, and master playlist filename.
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
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:
http://your.website.com/hls/stream.key d:\media\hls\stream.key 0123456789ABCDEF0123456789ABCDEF
Enter the path to the metadata file in the AES128 Encryption Key Info File field to enable stream encryption.
Note: The AES key is managed externally and can be updated periodically to enhance streaming security.