Green Screen Remover with a Moving Camera: Why the Key Drifts Mid-Pan

The wall is the same green in every frame. What moves is the window: a pan slides darker and brighter parts of the same backdrop under the lens, so the colour you sampled at the start is no longer the colour you are keying. The fix is to measure both ends of the move before the take — and to know that re-sampling every frame has its own price.

Short answer: a moving camera does not change the green wall, but it changes which part of the wall is under the lens. On a 1,000-pixel pan across a wall that falls to 40% brightness, the backdrop moved 25.57% away from the frame-0 sample: with 12%/8% the last frame kept 362,860 backdrop pixels above alpha 8, 83% of the backdrop. Measure the first and last frame, not the middle.

Measured 2026-11-18 on a synthetic 800×600, 60-frame pan with the exact colour-distance and alpha formula used by this site's keyer. Script: gsr-loop/scripts/moving-camera-20261118.js; raw result: moving-camera-20261118.json.

The wall did not change; the window did

A static-camera shot of an unevenly lit backdrop is one measurement: the bright corner and the dark corner are both in frame, and their spread is what the key has to cover. That is the uneven-backdrop problem, and on this site it was measured at 18.73% and 31.03% between the ends of one frame.

A moving camera is a different problem. Here the wall is fixed and the camera window slides across it. Each frame contains a different slice of the same gradient, so the backdrop under the subject gets darker or brighter as the shot progresses, and the patch you clicked in frame 1 is a different hex by the end. The subject can stand perfectly still in frame — a tracking shot where the camera follows a walker does exactly that — and the matte still changes, because the colour behind the subject changed.

The test below makes the wall do one simple thing: full brightness from wall position 0 to 500 px, then a straight falloff to 40% brightness at 1,800 px. The camera pans 1,000 px in 2 seconds (60 frames at 30 fps, 500 px/s). A multiplicative darkening of #00b140 moves the colour distance by 42.61% per unit, the slope measured on the shadow page; that is why a 60% darkening lands at 25.57% and not at some arbitrary number.

Five frames of the same pan. “Patch” is the clean backdrop pixel the key would be sampled from (frame x=400, y=60). “Far distance” is the largest backdrop distance from the frame-0 key. Residue counts are backdrop pixels, out of 437,260, with alpha > 8 after the stated key.
FramePan pxPatch hexPatch driftFar distance12/8 residue22/3 residuePer-frame 12/8
00#00b1400.00%5.88%000
15254#00a43b3.03%10.88%000
30508#0090348.02%15.87%110,40000
45763#007b2c13.04%20.89%230,67200
591,000#00672517.70%25.55%362,860105,6000

Residue is any backdrop pixel the key left above alpha 8, including the soft band. Of the 362,860 at frame 59, 249,128 are at alpha 128 or higher — 57% of the backdrop is not merely tinted, it is fully opaque. The 22/3 column is cleaner at the far end only because its ball is larger, not because it is the right setting: at the start it already deletes a 50/50 hair edge (17.75%), which is the failure measured on the hair-flicker page.

The failure is invisible until it isn't

Frame 30 is the trap. The locked 12%/8% key has 110,400 backdrop pixels above alpha 8 there, and zero of them are visible at alpha 128. A fit-to-window preview of the middle of the move passes. The pressure builds in the soft band first, then the far end of the wall crosses tolerance plus softness and goes solid: 149,400 visible pixels at frame 45, 249,128 at frame 59.

That is why the check has to happen at the two ends of the move, not at the frame that happens to be on screen when you open the project. It is the same arithmetic as the edge-check page, applied across time instead of around a silhouette: count residue at 100%, and count it in the first and last frame.

The other half of the table is the reason a single sample survives longer than you would guess. The patch itself drifts 17.70% by the last frame. Within that frame the brightest backdrop still in view sits 7.86 points below the patch and the darkest sits 7.87 above it — the whole 800-pixel window spans about 15.7 points of the wall. A per-frame sample therefore needs only 7.9 points of tolerance to clear that frame, against 25.57% for one locked sample. The pan is a 25.57% problem; each frame is a 7.9% problem.

Why re-sampling every frame is not the fix

The obvious repair is to sample the backdrop again on every frame. It does clear the backdrop: the last column of the table is zero for all five frames. It also changes the colour the edge is measured against, and an edge pixel is a mix of subject and local green, so as the wall darkens toward the subject’s own colour, that mix slides toward the key.

On this frame the 50%-coverage hair edge reads alpha 183 at the start and alpha 0 at the end under per-frame sampling. Under a locked key it goes the other way: 183 to 255, a hard edge. Neither is stable, and the mean edge error says the same thing: 62.2 to 81.5 with per-frame sampling, 62.2 to 111.0 with a locked key.

Same five frames, two ways of choosing the key. “Hair 50%” is the mean alpha of edge pixels whose true coverage is 0.47–0.53 over hair. “Edge error” is the mean |alpha − true coverage × 255| over all 664 partial pixels.
FrameLocked hair 50%Per-frame hair 50%Locked edge errorPer-frame edge error
018318362.262.2
15231.7138.161.362.4
3025559.067.963.4
452552.885.265.9
592550111.081.5

Three limits fall out of the same numbers, and they are the useful part because they do not depend on this particular wall:

The honest reading is that this pan crosses too much falloff for either strategy. 60% darkening is 25.57 points of drift; the locked key runs out at 28.2% darkening but leaves a hard, opaque far end long before that, and the per-frame key runs out of hair edge at 18.2%. The answer is not a better slider; it is a flatter wall or a shorter move.

What it looks like at frame 45

Four 280 by 280 crops of a green screen shot with a moving camera. Left: frame 0, bright backdrop. Second: frame 45 of the same pan, visibly darker green behind the same subject. Third: frame 45 keyed with the frame-0 sample at 12% tolerance and 8% softness, where the backdrop survives as a bright grey gradient and the hair edge is solid white. Fourth: frame 45 keyed with a per-frame sample at the same settings, where the backdrop is black but the hair edge has faded away.
A 280×280 crop of the subject’s right edge, shown as source and as alpha matte on black. Left to right: (1) frame 0, backdrop #00b140; (2) frame 45, same subject, backdrop #007b2c; (3) frame 45 with the frame-0 key at 12%/8% — 230,672 backdrop pixels above alpha 8, 149,400 of them visible, and the hair edge pushed to 255; (4) frame 45 with a per-frame key at the same settings — zero backdrop residue, but the 50/50 hair edge is 2.8. Both mattes are the measured output of the same formula the browser keyer uses.

The source panels are darker at the right because the wall is darker there, not because the exposure changed. A real camera with auto exposure may also change exposure as the bright end leaves the frame, which stacks on top of this; lock exposure and white balance before the move.

Measure your own move: pan drift meter

Pick the green at the start of the move and the green at the darkest point the lens will see, then the subject colour you cannot lose. The meter uses the keyer’s exact RGB-distance formula and tells you whether a locked key holds, whether a per-frame key holds the edge, or whether the move itself is the problem. Nothing is uploaded and nothing is guessed: every output is arithmetic on the four inputs.

The meter assumes the edge pixel is a 50/50 mix of subject and local backdrop, the same convention as the measured tables above. It does not know your actual path: enter the darkest green the lens will see, not the average. The default far-end swatch is the nearest 8-bit hex to the model’s 40% brightness, so it reads 25.50% here against 25.57% in the model — a colour picker cannot return the fractional value.

What to do on set and in post

  1. Walk the whole move before the take. Look through the camera and find the darkest green the lens will see at any point in the move. That patch, not the first frame, sets the problem.
  2. Measure both ends with a picker. Two hex values and one subject colour are enough for the meter above. If the end-to-start distance is already over 28%, no locked setting will clear the far end.
  3. Cut the falloff at the source. Add a fill on the dark end, move the key light, or shorten the pan. A 60% falloff across the move is 25.57 points; halving the move halves it.
  4. Do not let auto exposure ride the move. As the bright end leaves frame the camera may raise exposure and brighten the already-dark green, which adds a second drift on top of the first. Lock exposure and white balance.
  5. Choose one key or per-frame, knowingly. Locked: clean start, opaque far end and a hardening hair edge. Per-frame: clean backdrop everywhere, but dark edges fade as the wall darkens. Check both ends and pick which failure you can fix in post.
  6. If the range is unavoidable, split the shot or roto. A cut at the midpoint lets each side use its own key; the alternative is a roto on the far section. There is no tolerance that solves it.
  7. Check at 100%, at both ends. The middle frame passes while the end fails; see the 110,400-pixel soft band at frame 30 with zero visible pixels.

Questions that come up on a moving shot

Why does the background key out at the start and stay green at the end?

Because the key colour is fixed and the backdrop is not. A key is one point in colour space plus a radius; the wall under the lens is a moving sample of a lit surface. In the test the frame-0 sample is #00b140 and the far end is #006725, 25.57% away. The 12%/8% key reaches 20 points from the sample, so everything past 20% stays opaque. The pixels were never “missed” by the key; they were outside its radius from the first frame onward, and the pan simply brought them into view.

Should I re-sample the green on every frame?

Only if you accept the edge cost, and only if the wall does not darken much. Re-sampling cleared the backdrop in every measured frame, but the 50/50 hair edge went from alpha 183 to 0, because the edge pixel is a mix of hair and local green and that mix moves toward the key as the wall darkens. The derived limit is 18.2% darkening before the edge falls below alpha 64. If your move is flatter than that, per-frame sampling is reasonable; if it is steeper, re-sampling trades a green backdrop for a disappearing hairline.

Does a gimbal or a handheld shot change the answer?

The arithmetic is the same; the path is harder to measure. A pan across a wall mostly changes which slice is in frame. A gimbal walk also changes the angle to the wall, so the sampled patch moves both across the gradient and up and down it, and a handheld shot adds roll. Measure several points along the actual path, not just the two ends, and use the largest distance. The check is still the same: the darkest green the lens sees at any moment.

Does camera motion blur change the key colour?

Barely, on a smooth wall. At 500 px/s and a 1/50 s shutter the frame smears 10 px; across this wall’s falloff that averages to a 0.20-point shift in the sampled green. What it does change is the silhouette: the edge becomes a 10-px ramp of subject mixed with green, and at 800 px/s and 1/50 s it is 16 px. That edge cost is measured on the motion-blur page; this page only notes that a moving camera smears the whole frame, while that page’s test moved the subject in front of a static camera.

Can I key a moving-camera clip in the browser tool?

No. The keyer reads one still image, caps the working canvas at 1400 px on the long edge, and has no timeline. For a moving shot, export a frame sequence, key the first and last frame at full size in an editor or with the same formula, and only then commit to one setting. The export path and the alpha checks are on the video page; the keyer is useful here for checking a single still at 100%, not for judging a move.

Do I need tracking markers on the green screen?

If you also have to solve the camera move in post, usually yes — a flat wall gives a tracker nothing to follow, and the same shooters say to keep three or four features visible through the whole move. The cost is that a marker is not green: the key sees it as an opaque island exactly the way it sees a green scarf, so every marker becomes a hole in the matte that has to be painted out. Put them where the subject never covers, keep them out of the darkest part of the falloff if you can, and count them as part of the matte check rather than as set dressing. For the key itself, a moving camera still needs the two-end measurement above; markers solve tracking, not tolerance.

Next step

If the leftover is a broad green cast on the subject rather than the backdrop, that is spill. If it is a ring of partial alpha around the silhouette, start with the edge-check page. If the backdrop is uneven but the camera never moves, the uneven-backdrop page is the right measurement, and the tolerance table gives the material distances this page assumes.