Frame stepping · scale · automatic tracking · velocity · curve fits

Video Motion Tracker

Calibrate a clip against a known length, follow one or more objects frame by frame, and read positions, velocities and fitted accelerations in real units.

Video

MP4 or WebM, up to 400 MB

Drop a video here or click to choose

Film square to the motion and keep the camera still.

Scale and axes

Open a video before setting a scale.

Without a scale, results cannot be given in metres.

Tracking

Larger than the most the object moves between frames.

Open a video before tracking.

Velocity and acceleration come from a quadratic fit over this many points.

Frame

Open a video to see its frames here.

Video Motion Tracker

Operator: Abdulla Al Fahad. How tools are built and checked

A phone clip of a ball toss contains the acceleration of gravity, a pendulum clip contains its period, and a cart clip contains its speed, but only once pixels become metres and frames become seconds. This page does that conversion in three steps: you click two points a known distance apart, the tool follows the object from frame to frame, and the positions are turned into velocities, accelerations and curve fits.

It is built for the physics-lab case, one camera fixed and square to a motion in a plane, with up to four objects, clips up to 3 minutes and 400 MB.

Key features

  • Frame stepping with a slider and previous and next buttons, with frame times from a frame rate or measured from the file
  • Scale from two clicks and a known length, an origin you place and an axis angle, with y pointing up
  • Automatic tracking by normalised cross-correlation in a search window, with a sub-pixel peak and a score for every frame
  • Manual tracking where each click records a point and steps one frame, and a click to correct the object when the automatic track loses it
  • Velocity and acceleration from a local quadratic fit over a window that uses the true frame times
  • Straight-line, parabola and sinusoid fits that report velocity, acceleration or period with the residual, plus distance and angle between objects

From pixels to metres and seconds

The browser plays the clip and the page seeks to each frame, so any MP4 (H.264), MOV or WebM file the browser can play will work. Frames are drawn at no more than 1280 pixels on the long side and all pixel positions refer to that working picture; the scale you calibrate is in the same units, so the reduction cancels.

Frame times are index divided by the frame rate unless you ask for the real ones. Reading real times plays the clip once, using requestVideoFrameCallback where the browser has it, and records the presentation time of every frame; the time of each tracked point then comes from that list, which matters for phone clips whose frame spacing wanders.

How it works

At the first frame you click the object. The page takes a square patch around the click, removes its mean, and for every later frame slides it over a search window around the last position, scoring each placement by normalised cross-correlation. The best score gives the position, refined to a fraction of a pixel by a parabola through the neighbouring scores.

A score under 0.60 stops the run at that frame and says so, so a lost object is corrected by hand instead of silently corrupting the data.

Common use cases

  • A student films a ball dropped beside a metre rule, calibrates on the rule and fits y(t) with a parabola. Twice the quadratic coefficient is the acceleration to compare with 9.81.
  • A pendulum is filmed from the front. The sinusoid fit to x(t) returns the period and amplitude directly, so the length-period relation can be checked from the slider length.
  • A cyclist's phone clip shows a frame spacing that drifts between 28 and 33 frames per second. Reading real frame times keeps the velocity honest where a fixed 30 fps would make it ripple.

How to use this tool

  1. Open the clip and set the frame rate, or press Read real frame times.
  2. Click two points a known distance apart, enter the distance and press Set scale, then click to place the origin.
  3. Switch on Track mode, click the object in the first frame and press Track forward.
  4. Read the fits and download the spreadsheet.

Example

A ball dropped beside two marks 200 pixels apart, entered as 1 m, filmed at 30 frames per second with Read real frame times pressed; Track forward followed it for 17 frames before the match fell to 0.46 and the run stopped

Quadratic fit of y(t) over the 17 tracked points

Fit shown under the picture

y(t) quadratic: acceleration -9.761 m/s2 against a true 9.81, an error of 0.5%; y points up, so gravity is negative
rms residual 1.52 mm
Windowed acceleration for the middle frames: -9.7 to -10.0 m/s2

Tips for best results

  • Click on the sharpest edge or marking of the object, not on a flat colour: a patch with almost no texture is refused because it cannot be followed.
  • Choose a search radius a little above the largest distance the object moves in one frame; a very large radius lets the match jump to a similar-looking thing.
  • Fit over the free-flight frames only. Track forward runs to the end of the clip, so press Cancel at the last good frame, or click by hand near the floor, and clear the object to start again if hands or the table got into the track.
  • Use a larger smoothing window for velocity and acceleration plots on noisy clips, but quote g from the quadratic fit, which uses all points at once.

Common pitfalls

Filming too slowly for the motion aliases it. When the sinusoid fit finds a period shorter than about four frames, the page shows an aliasing warning, because the true period may be much shorter than the one fitted.

The scale holds only for things at the distance of the reference. A ruler held in front of the path or behind it gives a wrong metres-per-pixel for the object.

Rolling shutter, lens distortion and a tilted camera bend straight motion, and slow motion shot at 240 fps may play back at 30; enter the capture rate, not the playback rate.

Common errors and how to fix them

Lost the object at frame 37
The correlation fell under 0.60, often from motion blur or the object turning. Click it on that frame, then press Track forward again.
That spot has no texture to follow
The chosen patch is nearly uniform. Click on an edge, a printed mark or a contrasting part of the object, or enlarge the template half-size.

Best practices

  • Film at the highest frame rate the camera offers and with a short exposure, so the object is sharp in every frame.
  • Keep the camera on a tripod and the motion in a plane parallel to the sensor.
  • Put the reference length in the same plane as the motion and at the same distance.

How velocity and acceleration are computed

For each point the page fits a quadratic to a window of neighbouring points (three to 21, odd, default 7) using their real times, which is a Savitzky-Golay filter of order two that stays correct when the frame spacing is uneven. The fitted value, the slope and twice the curvature at the centre are the smoothed position, velocity and acceleration, and the window is kept the same size at the ends.

Differentiating positions amplifies noise, so these accelerations are rougher than a fit to the whole track. In the example above, the windowed acceleration scatters between -9.7 and -10.0 m/s2 across the middle frames, while the whole-track fit gives -9.761.

What is not here

There is no lens-distortion correction, no automatic scale detection and no annotated video output. Trails can be saved on a single frame as a PNG, and positions as XLSX or CSV for plotting elsewhere.

Frequently asked questions

Can I get g from a clip I filmed on a phone?

Yes, within the limits of your scale: a 1% error in the reference length gives a 1% error in g. In the example above, with the true scale known and real frame times read, the fit landed 0.5% from 9.81; with the nominal 30 fps spacing instead of the real frame times the same track gave -9.674, 1.4% off, so the frame times matter as much as the scale.

Why does the tool ask for the frame rate of the clip?

A video file stores frame times, but this page steps frames by seeking, so it needs the spacing. If the clip was filmed in slow motion, enter the rate it was captured at.

How many objects can I track at once?

Up to four, each with its own colour and its own results; distance between objects 1 and 2 and the angle at object 2 between 1 and 3 are reported when they exist.

Does it track through a rotating object?

A rotating object changes its own appearance, so the template can lose it. Tick Refresh the template to let the patch update when the match is above 0.85, and check the track by eye since it can drift.