In this article, we will cover how to perform video streaming (downloading action) tests with JMeter.
First of all, let’s talk about what happens in the background while watching any video.
Several communication standards are used to transmit and share video data. We call these video protocols. These protocols contain specific rules and guidelines to properly transmit and process video streams and files between the client and server. Here are explanations of some basic video protocols:
The two most used protocols today are MPEG-DASH and HLS protocols. Let’s continue our article with videos using the HLS protocol.
Videos processed with the HLS protocol use components with manifest and .ts extensions. HLS offers dividing videos into segments and providing these segments with different quality levels.
Manifest Files
.ts (Transport Stream) Extensions
Now let’s do an example with the information we have learned so far. We will use New York Times website as an example.
As you can see, when the video starts, the components we mentioned above appear as HTTP requests.
In videos with subtitle support, text files are among these requests.
Now let’s see how to do what we have learned via JMeter. To do this, we first need to download the plugins-manager.jar file from the link to the lib/ext folder in the JMeter folder on our computer. After completing this process, when we open JMeter, we can access the plugins as can be seen in the picture.
We can download the plugin we will use in video tests by typing HLS Plugin in the Available Plugins field.
Test Creation
We will use the sampler called “HLS Sampler” when creating video tests. To add the sampler, we can right-click on the Test Plan and follow the path Add → Thread Group → Add → Sampler → HLS Sampler.
Configuration
In the URL field; You need to write the URL of the manifest (.m3u8 or .mpd) that creates the video and contains general information about the video. So how do we find this?
We can capture this URL information by using the Network tab in the browser as we showed in an example above or by using JMeter’s Recording feature while the video is playing. It is usually named manifest or master. In our example, this URL value is “https://vp.nyt.com/video/hls/2023/08/01/110343_1_opdoc-clean_wg/master.m3u8".
You can set the duration you want to download from the video in the Play Option section. Duration can be “Entire video” or a custom duration in seconds.
We can determine the resolution values we want to test with the Bandwith and Resolution fields. We can select the minimum and maximum fields for both values. In these cases, the plugin bases the minimum and maximum values in the manifest file.
If we want to test specific values, we can select the “Custom” field and enter the values we want. The values entered here must be the same as the values in the manifest file. For our example, let’s take the relevant value as 1920x1080.
After all these configuration settings are made, let’s add View Result Free and run the test to see the results.
For this test, we will use a Custom Video duration of 60 seconds, with bandwidth at minimum and resolution at 1080P. With these configurations, the sampler should look like the image below:
When we start the test after making the relevant settings, the plugin will start downloading the manifest and segment files from the specified URL.
And voila! We have successfully requested and watched a video with a virtual user.
To check the accuracy of the test, we can check the response of the HLS Sampler — master playlist service. The response of the relevant service will include information such as language settings, bandwidth, and resolution settings of the video URL we tested.
As you can see, the values we see on the Network tab in the browser are the same as the values we see when we test with JMeter.
When you finish creating your JMeter script to test your HLS videos, you can upload it to Loadium and enhance your testing abilities with better reporting, collaboration, and scalability.
Loadium also allows you to generate traffic from all over the world, testing the performance of your server for users worldwide.