Measures input lag without dedicated hardware, performing motion detection on recorded or live video

Overview

What is InputLagTimer?

This tool can measure input lag by analyzing a video where both the game controller and the game screen can be seen on a webcam or a video file.

Here's how it looks in action:

Usage demo

Even though the typical usage is game latency, InputLagTimer can measure any latency so long as it's captured on video. For example, if you point a camera at both your car key and its door lock, you can measure how fast that remote unlocks your car.

How does it measure input lag?

You first mark two rectangles in the video you provide:

  • 🟦 Input rectangle (blue): where the input motion happens. Such as a gamepad stick.
  • πŸŸͺ Output rectangle (purple): where the response will be visible. Such as the middle left of your TV screen, where the front wheels can be seen turning in your car simulator.

InputLagTimer will detect motion on the input area, and time how long it takes to detect motion on the output area.

Things should work for latencies of up to 700ms; if you need to measure slower events, the limit can be trivially edited in code.

How to use it:

  1. Download InputLagTimer (some windows binaries are available on github if you prefer that)
  2. Open InputLagTimer:
    • Plug your webcam then run the program.
    • Or drag-and-drop your video file to the program.
    • Or, from command line, type InputLagTimer 2 to open the 3rd webcam, or InputLagTimer file.mp4 to open a file.
  3. Press S then follow screen instructions to select the 🟦 input and πŸŸͺ output rectangles.
  4. Observe the input and output motion bars at the top, and press 1/2 and 3/4 to adjust the motion detection thresholds (white indicator). Latency timing will start when the input motion passes the threshold, and stop when the output motion does.

Note: a .cfg file will be created for each video, allowing to reproduce the same latency analysis.

Tips and gotchas

  • Use a tripod to hold the camera. The InputLagTimer is based on motion detection, therefore hand-held footage is doomed to spam false positives.
  • Disable gamepad vibration and put the gamepad in a table (unless you want to measure vibration-latency!): in other words,reduce unnecessary motion from both the input and output rectangles.
  • Select the 🟦 input and πŸŸͺ output rectangles as accurately as possible. E.g. to measure keyboard key travel time, draw an input rectangle including the entire key height. If you don't want to include key travel latency, draw the input rectangle as close to the key activation point as possible.
  • If using certain artificial lights, enable camera's anti-flicker feature when available (press C in InputLagTimer when using a webcam), or choose a recording framerate different than the powerline frequency used in your country (often 50Hz or 60Hz). This removes video flicker, vastly improving motion detection.
  • Prefer higher recording framerate, this provides finer-grained latency measurements:
    • Some phones and actioncams can reach hundreds of FPS.
    • Recording equipment may not reach its advertised framerate if it's not bright enough. If in doubt, add more lighting.
  • If your camera cannot reach the requested framerate (e.g. it only manages to capture 120FPS out of 240FPS, due to lack of light), consider recording directly at the reachable framerate. This eliminates the useless filler frames your camera was forced to duplicate, making it easier to tune the motion detection thresholds in InputLagTimer.
  • Prefer global shutter over rolling shutter cameras. Rolling shutter can slightly skew latency measurements, as one corner of the image is recorded earlier than the oposite corner.

Rolling Shutter example

(source: Axel1963 - CC BY-SA 3.0)

  • Screens normally refresh pixels from the top earlier than pixels from the bottom (or left before right, etc). The location of 🟦 input/ πŸŸͺ output rectangles in a screen can slightly skew latency measurements.
  • The pixels on a screen can take longer or shorter to update, depending on:
    • Pixel color. E.g. white-to-black response time might be longer than black-to-white.
    • Panel type. E.g. OLED will normally be much quicker than LCD panels.
    • Screen configuration. E.g. enabling 'overdrive', enabling 'game mode', etc.
  • Press A (Advanced mode) to see more keys and additional information.

Advanced Mode screenshot

Dependencies

To run the EXE, you don't need anythig else. So move along, nothing to see in this section :)

To run the python code directly, you'll need opencv for python, numpy, and whichever python interpreter you prefer.

To build the binary (with compile.py), you'll need PyInstaller.

Credits and licenses

InputLagTimer software:

Copyright 2021 Bruno Gonzalez Campo | [email protected] | @stenyak

Distributed under MIT license (see license.txt)

InputLagTimer icon:

Copyright 2021 Bruno Gonzalez Campo | [email protected] | @stenyak

Distributed under CC BY 3.0 license (see license_icon.txt)

Icon derived from:

You might also like...
Python scripts for performing object detection with the 1000 labels of the ImageNet dataset in ONNX.
Python scripts for performing object detection with the 1000 labels of the ImageNet dataset in ONNX.

Python scripts for performing object detection with the 1000 labels of the ImageNet dataset in ONNX. The repository combines a class agnostic object localizer to first detect the objects in the image, and next a ResNet50 model trained on ImageNet is used to label each box.

Python scripts for performing road segemtnation and car detection using the HybridNets multitask model in ONNX.
Python scripts for performing road segemtnation and car detection using the HybridNets multitask model in ONNX.

ONNX-HybridNets-Multitask-Road-Detection Python scripts for performing road segemtnation and car detection using the HybridNets multitask model in ONN

This project uses reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can learn to read tape. The project is dedicated to hero in life great Jesse Livermore.

Reinforcement-trading This project uses Reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can

NeuralCompression is a Python repository dedicated to research of neural networks that compress data

NeuralCompression is a Python repository dedicated to research of neural networks that compress data. The repository includes tools such as JAX-based entropy coders, image compression models, video compression models, and metrics for image and video evaluation.

SCAAML is a deep learning framwork dedicated to side-channel attacks run on top of TensorFlow 2.x.
SCAAML is a deep learning framwork dedicated to side-channel attacks run on top of TensorFlow 2.x.

SCAAML (Side Channel Attacks Assisted with Machine Learning) is a deep learning framwork dedicated to side-channel attacks. It is written in python and run on top of TensorFlow 2.x.

NeoPlay is the project dedicated to ESport events.

NeoPlay is the project dedicated to ESport events. On this platform users can participate in tournaments with prize pools as well as create their own tournaments.

This program was designed to detect whether someone is wearing a facemask through a live video stream.

This program was designed to detect whether someone is wearing a facemask through a live video stream. A custom lightweight CNN trained with TensorFlow on a public dataset provided by Kaggle is used to detect whether each face detected by the cv2 face detection dnn is wearing a mask

Video-Captioning - A machine Learning project to generate captions for video frames indicating the relationship between the objects in the video
Video-Captioning - A machine Learning project to generate captions for video frames indicating the relationship between the objects in the video

Video-Captioning - A machine Learning project to generate captions for video frames indicating the relationship between the objects in the video

Official implementation of the network presented in the paper
Official implementation of the network presented in the paper "M4Depth: A motion-based approach for monocular depth estimation on video sequences"

M4Depth This is the reference TensorFlow implementation for training and testing depth estimation models using the method described in M4Depth: A moti

Releases(v1.2)
  • v1.2(Mar 29, 2022)

    • Display summary of measured latencies: min/avg/max latencies and a histogram
    • Added display with the current framerate
    • Fixed incorrect timing when a webcam dropped below the advertised framerate
    • The 'a' key will now cycle between varying amounts of detail (more detail can lead to lower framerates)
    • Add CC license links on readme
    • Minor cleanups here and there

    Full Changelog: https://github.com/stenyak/inputLagTimer/compare/v1.1...v1.2

    Source code(tar.gz)
    Source code(zip)
    InputLagTimer.exe(50.81 MB)
  • v1.1(Jan 8, 2022)

    • Fix safety timeout kicking in too soon if using a custom maxLatency
    • Fix first webcam being ignored when running the program without arguments
    • Rename compiled file from camelCase to CamelCase

    Full Changelog: https://github.com/stenyak/inputLagTimer/compare/v1.0...v1.1

    Source code(tar.gz)
    Source code(zip)
    InputLagTimer.exe(49.22 MB)
  • v1.0(Jan 8, 2022)

Python library to receive live stream events like comments and gifts in realtime from TikTok LIVE.

TikTokLive A python library to connect to and read events from TikTok's LIVE service A python library to receive and decode livestream events such as

Isaac Kogan 277 Dec 23, 2022
Calculates JMA (Japan Meteorological Agency) seismic intensity (shindo) scale from acceleration data recorded in NumPy array

shindo.py Calculates JMA (Japan Meteorological Agency) seismic intensity (shindo) scale from acceleration data stored in NumPy array Introduction Japa

RR_Inyo 3 Sep 23, 2022
Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX.

scc4onnx Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel

Katsuya Hyodo 16 Dec 22, 2022
UMT is a unified and flexible framework which can handle different input modality combinations, and output video moment retrieval and/or highlight detection results.

Unified Multi-modal Transformers This repository maintains the official implementation of the paper UMT: Unified Multi-modal Transformers for Joint Vi

Applied Research Center (ARC), Tencent PCG 84 Jan 4, 2023
This repository contains the code for the paper "Hierarchical Motion Understanding via Motion Programs"

Hierarchical Motion Understanding via Motion Programs (CVPR 2021) This repository contains the official implementation of: Hierarchical Motion Underst

Sumith Kulal 40 Dec 5, 2022
Exploring Versatile Prior for Human Motion via Motion Frequency Guidance (3DV2021)

Exploring Versatile Prior for Human Motion via Motion Frequency Guidance This is the codebase for video-based human motion reconstruction in human-mot

Jiachen Xu 5 Jul 14, 2022
Jetson Nano-based smart camera system that measures crowd face mask usage in real-time.

MaskCam MaskCam is a prototype reference design for a Jetson Nano-based smart camera system that measures crowd face mask usage in real-time, with all

BDTI 212 Dec 29, 2022
Group project for MFIN7036. Our goal is to predict firm profitability with text-based competition measures.

NLP_0-project Group project for MFIN7036. Our goal is to predict firm profitability with text-based competition measures1. We are a "democratic" and c

null 3 Mar 16, 2022
Python scripts for performing lane detection using the LSTR model in ONNX

ONNX LSTR Lane Detection Python scripts for performing lane detection using the Lane Shape Prediction with Transformers (LSTR) model in ONNX. Requirem

Ibai Gorordo 29 Aug 30, 2022
A modular application for performing anomaly detection in networks

Deep-Learning-Models-for-Network-Annomaly-Detection The modular app consists for mainly three annomaly detection algorithms. The system supports model

Shivam Patel 1 Dec 9, 2021