Search code examples
streamingrtmphttp-live-streaming

How can one measure video streaming latency?


We're building yet another video streaming service with awesome killer feature™, and we need to estimate client latency to deliver off-stream events in sync. The video stream passes through several processors, including CDN in the very end of pipeline, so latency may vary and it's not possible to pass something with the stream.
How can i measure latency between the streamer and consumer? We have couple of weird algorithms, but they are not even close to be reliable. Reading RTMP timestamps is also not the option at the moment, and we're planning to deliver HLS as well.


Solution

  • One way would be to insert cue points / timed metadata into the stream and have your player read them. These can pass through the CDN, and you can use them to deliver events if you like, or just to measure the latency.

    The procedure for inserting/reading cue points varies with the media server and video player. I know Wowza can insert cue points into RTMP streams and convert them to ID3 metadata for HLS streams.