In this blog article, we're going to introduce you to HTTP Live Streaming, or HLS for short. You will learn how HLS works, and we will explore how to actually record media streams in Silk Performer 17.0. HLS is an HTTP-based media streaming communications protocol, which has been adopted for video delivery across the industry all around the world. Silk Performer automatically detects HLS traffic during recording and simulates a video player consuming HLS data during playback.
How HLS works
With HLS, the original media file is available as an MPEG-2 transport stream. MPEG-2 TS consists of one or more playlists and the related media segments. A playlist is an .m3u8 file and holds information about the segments. If the media file is a video, you will usually find a master playlist, which lists the resolutions the video is available in. The master playlist also references one playlist per resolution. The segments are parts of the original media file and appear as .ts files.
When a user starts watching a video, the client first requests the playlist file. Based on the information in the playlist, the client will then download the segments of the video. This leads to a constant stream of files from the server to the client. Take a look at the graphic above to better understand the concept of HLS. Note that the whole communication is handled over a standard HTTP connection.
Recording HLS traffic
We will now take a look at how to record HLS traffic. At the end of this example, we will find the .m3u8 and .ts files in the Try Script TrueLog. But first things first. Let's start with creating a new project. Make sure to select the new project type HTTP Live Streaming (HLS). For this example, we will be recording the HLS sample application, which is available on our demo website. If you want to follow along with this example, you can use this demo app as well.
Enter the URL of the demo app and start the recording. We're going to use the Big Buck Bunny video for this demonstration, so click Big Buck Bunny to load it. This video is available in five different resolutions. Below the resolutions, we can see the URL of the master playlist. Later, we will find this URL again in our script. Click the play button to start the video stream. The video will start with the default resolution of 720, however the video player might switch to a different resolution based on your bandwith. In our example, the player switches to a resolution of 1080 (the maximum) after 10 seconds. But of course you can also change the resolution manually at any time. In our example, we click the respective button to switch to a resolution of 480 pixels. We can now close the browser and stop the recording.
Investigating the script
Now, let's take a look at the script Silk Performer created. First, look out for the HLSInit() function (1). This function creates a handle (2) to the video stream. The handle is initialized by the subsequent web function call (3), which requestst the playlist file (4). This is the URL we saw in the browser just a minute ago. The HLSPlay() function (5) starts the stream. We can see that the stream first was started with the default resolution of 720 (6), then the browser automatically switched to 1080 (7), and then we manually switched to 480 (8). The next parameters describe the start time (9) and the duration of the stream (10).
The start times show us that the video is split up into 10-second-segments. We're going to adjust the script, so that Silk Performer simulates a full stream only for the resolution of 480 (1). This means substituting FULL_STREAM with the value 10.00 for the resolutions 720 and 1080 (2).
Executing a Try Script run
Now it's time to try out the script, so click Try Script on the workflow bar. On the subsequent dialog, make sure to Disable video playback simulation. This option is checked by default and it ensures that Silk Performer simulates the download of the .ts files, but it does not simulate the actual playback. This setting is recommended for Try Script runs as it usually saves you a lot of time. Click Run to start the Try Script.
Investigating the TrueLog
When the run is completed, the Try Script Summary page displays. Click Explore TrueLog file to open the TrueLog. In the tree we can find the master playlist (1) (the .m3u8 file) and three HlsPlay nodes (2). Under the HlsPlay nodes, you can see the playlists for each resolution as well as the downloaded .ts files for each of the recorded resolutions.
Silk Performer 17.0 automatically detects HLS traffic during recording. Just remember to use the new HTTP Live Streaming (HLS) project type, when you create a new project.
Watch the HTTP Live Streaming video
The following video also shows the above described steps. Watch it to get a good idea of how HLS works and how to record media streams with Silk Performer:
To learn more about all new features and enhancements Silk Performer 17.0 provides, take a look at the following blog post:
- Released: Silk Performer 17.0
- Performance Explorer Enhancements
- Generating Clean Scripts
- Improved CloudBurst Workflow
- Evaluating Agent Capacities
The Silk Performer Help is another comprehensive source of information:
If this article was useful for you, leave us a comment or like it. We appreciate any of your feedback.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.