Skip to content
Nikolaos Kamzelas edited this page Nov 8, 2018 · 11 revisions

Speedrun Load Remover

What is it?

Speedrunning is the hobby of playing video games with the goal of finishing them as fast as possible. In order to make competition healthy, communities agree on timing standards, one of which is RTA (real time attack), where players rely on a timer external to the game they are playing. This method, however, implies that timing errors such as framerate drops and loading times will be introduced to the final time, giving an advantage to players with better hardware. Out of the two, loading times can be relatively easily accounted for, and, depending on the level of competition and the variance of loading times among different systems, the need for what is called loadless timing might become imperative.

This tool aims to rid runners of the time consuming task of manually retiming their runs using video editing software or otherwise. To achieve this, it employs computer vision to detect and count all "now loading" frames in a video recording of a speedrun.

Quickstart guide

  1. Open your video file or paste your YouTube video ID (e.g. C_VheAwZBuQ).
  2. Navigate to and mark the time start and time end frames of the speedrun, effectively getting the RTA time.
  3. Select an appropriate subregion of your video.
  4. Navigate to and mark the frame to be used as the template for the game's loading screen.
  5. Calculate the loadless time.

Opening a video

You have the option to open a local video file or download a YouTube video. Start by clicking Open. Choose a video file or paste only the ID of your YouTube video in the file name box. The video ID is the alphanumeric string that follows watch?v= in a YouTube URL (e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ). The YouTube video will be downloaded to the folder currently open in the dialog.

  • If your video fails to download, it could be a shortcoming of the downloading libraries. You can try downloading it using a different service and opening it locally.
  • If the downloaded video is of .webm format, it will not work, as it is not supported by the WPF MediaElement class used to play the videos. You will have to convert it to another format such as .mp4 and open it again.

Timing the run

RTA

Getting the RTA time is as simple as marking the first and last frame of the run, as agreed upon by your speedrunning community. Navigate the video using the slider, click (and optionally hold) the < and > buttons to advance by one frame, or shift-click them to advance by one second. Clicking the buttons will pause the video. Clicking Mark S will mark the currently visible frame as the first frame of the run. Clicking Mark E will mark the frame prior to the currently visible one as the last frame of the run. With each click, the RTA time gets updated and reported. Thus, for a hypothetical one-frame run, you would click Mark S, >, Mark E. If left unmarked, the run will remain as the first through last frame of the video.

Loadless

The tool detects loading frames by sifting through every frame of the run and comparing them against a template frame given by the user.

In order to eliminate the errors introduced by outside elements such as stream overlays or the inconsistencies of dynamic loading screens, you are given the option to confine all operations within a subregion of the video frame by using the selection box. To make a selection, drag the handles of the box or click and drag inside it to move it, navigate the video to a loading screen and click Frame. The currently visible frame becomes the template, and appears in the bottom right corner of the window.

At this point, the algorithm calibrates itself by comparing the template to the pair of frames ±3 steps ahead and behind the template frame. It is assumed that those frames are loading frames as well. Each comparison returns an error value (as per OpenCV's CV_TM_SQDIFF), and the higher error, multiplied by 1000, becomes the threshold to be used for the counting operation that starts when you click Count.

The counting workload, i.e. all frames between start and end of the run, get split up in a number of chunks equal to your system's logical processor count (the number of CPU "cores" that appear in your task manager), and start getting processed in parallel, making full use of your CPU. During this process, each frame gets compared against the template and is counted as a loading frame if the error value is smaller than the threshold.

Throughout the process, each video frame, as well as the template, gets scaled down to around 10000 pixels in order to speed up the processing. Hence, the computation time scales primarily with frame count (duration * framerate) of the run, and to a lesser extent with video resolution, but not with the size of the selection.

After the work is completed, you are presented with the loadless time, and some other information. To help you verify the accuracy of the result, the Match indicator next to the template will light up when the currently visible frame in the player was matched as a loading frame during the last counting process.

What makes a good subregion?

Try to select the largest region that is as static as possible. If you select a relatively dark region, then black screens and fadeouts might be mistakenly counted as loading frames. As the calibration algorithm isn't very robust, you might find the tool matching zero or all frames as loading frames. In that case, try moving your selection slightly or grabbing a different frame. Please take some time to experiment on a short run to find a configuration that works best for that game, and sorry for the inconvenience.

Contributions

Feel free to contribute to this project in any way. If you are super hot about seeing it improve but have no skills to improve it, you can contribute money to my PayPal as a way of motivating me. Thank you. ❤️

Credits