Apple provides a bunch of tools to create and (more important for me) to validate HLS streams.

Media Stream Validator (mediastreamvalidator) simulates an HTTP Live Streaming session and verifies that the index file and media segments conform to the HTTP Live Streaming specification. This tool can validate local files and HTTP URLs.

The last article shows how to build a HLS stream using FFmpeg. Now we validate the stream using Apples tool here.

How to use

First we download the toolset called “HTTP Live Streaming Tools”. This includes also the mediastreamvalidator. You can download them directly from Apples Developer Portal using the following URL: HTTP Live Streaming Tools

After installation, all you need is your terminal.

Important: Choose your working directory. This folder will be used by default to store the results of the validation.

cd ~/Downloads

I’ll use the downloads folder of my Mac.

mediastreamvalidator https://domain-to-stream.martin-riedl.de/master.m3u8

If you have a long video stream you can quit parsing at any time my by pressing Control + C. It just stops downloading new files but still prints a result over the already parsed files.

Results

The tool prints directly into your terminal a short summary and possible issues. But it also writes all results into a validation_data.json. You can run the following command to build a nice html report:

hlsreport.py validation_data.json

After opening the html file “validation_data.html” in your browser you find two sections at the end:

  • Must Fix Issues: We should really check them and try to solve it. This is important, because otherwise the stream could have playback issues on Apple devices like the iPhone or iPad.
  • Should Fix Issues: Correct them to improve the usability or provide nice to have features.

The articles in the next weeks will fix some of the issues that appear in the report.