Skip to content

Why does my comparison revert to the source after a shorter replacement layer runs out?

The overlay's end-of-stream rule controls what the viewer sees. Pass-through with no final-frame repetition makes the background visible when the foreground runs out.

PLAN AN EXTERNAL VIDEO REPAIRAISwapLab team · Editorial methodPublished 2 min read
See the recorded exampleExplore 67 Image SkillsIndependent finishing · Check the actual file

Set up the edit

Put the original under the returned layer. End the foreground early on a short duplicate to make the change obvious. Find the first background-only frame and compare its time with the end of the top layer.

shell
ffmpeg -i studio.mp4 -i duo-result-silent.mp4 -filter_complex "[0:v:0]setpts=PTS-STARTPTS,fps=24,scale=384:216,setsar=1[a];[1:v:0]setpts=PTS-STARTPTS,fps=24,scale=384:216,setsar=1[b];[a][b]overlay=eof_action=pass:repeatlast=0[proof]" -map "[proof]" -fps_mode passthrough -c:v ffv1 inspection.mkv

Read the result

When the switch occurs at the layer boundary, an apparent identity reversal can be an editing decision. If both layers still have video there, inspect their individual pictures.

With the synchronized viewing copies of the original and returned living-room clip, the local FFmpeg run decoded 144 video frames at 384 × 216 pixels. The recipe resets timestamps and fits both streams to the same 384 × 216 viewing raster at 24 fps before applying the comparison.

If the first pass falls short

Choose a shortest-common-duration comparison when an unmatched tail is irrelevant. When showing the tail matters, explicitly label the first frame for which no replacement exists.

Sources

Review the result in context.

Compare the recorded example and its documented limitations.

See the recorded example