Video Stream Benchmark – python wrapped in docker

Having worked on a bunch of applications that read and manipulate streams lately, I needed to do some stress-testing to check out how much one of those streams can take.

The first thing that came to mind was to build something like ApacheBench but with more control over concurrency and, of course, with customizable “visit” duration.

So I wrote this simple Python script that does just that from inside a Docker container, meaning that it’s easy to get a hold of and start running tests on any system supporting Docker.

The script simply calls multiple instances of ffmpeg with the required parameters targeting the given stream URL. It supports whatever ffmpeg supports (RTSP/RTMP/HLS/Direct Video/whateverdafuq).

Now that I got bored, as usual, here’s the copy-pasted readme.

Setup

Install Docker

https://docs.docker.com/install/

Pull docker image from hub.docker.com

docker pull psyb0t/video-stream-benchmark:latest

Usage

docker run --rm psyb0t/video-stream-benchmark [connection_length] [connection_num] [benchmark_url]

  • connection_length – the time to spend on a ongoing connection in seconds
  • connection_num – the number of concurrent connections to start
  • benchmark_url – the stream URL to benchmark

Example Command

docker run --rm psyb0t/video-stream-benchmark 60 100 http://streaming-server.net/stream/playlist.m3u8

Example Output

{
  "benchmark_url": "http://streaming-server.net/stream/playlist.m3u8",
  "connection_length": 60,
  "connection_number": 100,
  "elapsed_time": "62016ms",
  "success_count": 100,
  "error_count": 0
}

As always, here’s the github link https://github.com/psyb0t/video-stream-benchmark