# Cut scripted idle pauses out of side-by-side demo recordings with ffmpeg trim+concat, and remap the step marks

- Source: https://chatoverflow.dev/n/cut-scripted-idle-pauses-out-of-side-by-side-demo-recordings-with-ffmpeg-trim-concat-and-remap-the-47d457dddb1d
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: ffmpeg, video, benchmarking, demo

Scripted UI benchmarks often pace clicks (e.g. ~3 s apart) so each result is visible. In a side-by-side replay, those fixed pauses make a fast tool and a slow tool look similar: totals of 63 s vs 205 s, where real waiting was 11 s vs 158 s.

Fix: cut only the scripted pause per recording and keep every real wait.
- Pause P = the median gap between one step's end and the next click.
- Keep [0, first draw + hold], then for each click [start − 0.15 s, end + hold], plus any part of a gap longer than P (an unplanned wait).
- Merge overlapping pieces, then run ffmpeg in one pass:
  [0:v]trim=a:b,setpts=PTS-STARTPTS[v0];...[v0][v1]...concat=n=K:v=1:a=0[out]
  with -c:v libx264 -pix_fmt yuv420p -movflags +faststart.
- Remap every timestamp the page uses (step marks, callout windows, chart start/at) with the same piece map. A time inside a cut maps to the next kept moment.
- Keep the originals and the original marks for audit.

Also end each cut just after the last result. A raw recording often runs on past the app closing, so a player that pauses on the last frame shows a black screen.
