Pipeline Stages

Speed Processing

Automatically adjust video speed based on activity classification.

The .speedUp() stage classifies every moment of the trace into activity types and applies different playback speeds to each. Idle time flies by while user actions play at normal speed.

Basic usage

await Recast
  .from('./traces')
  .parse()
  .speedUp({
    duringIdle: 4.0,
    duringUserAction: 1.0,
  })
  .render()
  .toFile('demo.mp4')

Activity classification

The speed processor analyzes the trace and classifies each segment:

ActivityDefault SpeedDescription
User Action1.0xClicks, fills, keyboard input — plays at real-time
Navigation2.0xPage loads, redirects — slightly faster
Network Wait2.0xAPI calls in flight — compresses wait time
Idle4.0xNothing happening — skips quickly

Configuration options

OptionTypeDefaultDescription
duringIdlenumber4.0Speed multiplier for idle segments
duringUserActionnumber1.0Speed multiplier for user interactions
duringNetworkWaitnumber2.0Speed multiplier for network activity
duringNavigationnumber2.0Speed multiplier for page navigations
minSegmentDurationnumber500Minimum segment length in ms (avoids jarring speed changes)
maxSpeednumber8.0Safety cap on speed multiplier

Full example

.speedUp({
  duringIdle: 4.0,
  duringUserAction: 1.0,
  duringNetworkWait: 2.0,
  duringNavigation: 2.0,
  minSegmentDuration: 500,
  maxSpeed: 8.0,
})

CLI equivalent

npx playwright-recast -i ./traces --speed-idle 4.0 --speed-action 1.0

Tips

  • Speed processing respects segment boundaries. Setting minSegmentDuration prevents rapid speed switching that can look jarring in the output.
  • When voiceover is active, segments where TTS audio is significantly shorter than the original timing trigger fast-forward automatically.
  • Click effect and cursor overlay timestamps are automatically remapped through speed processing, so visual effects appear at the correct video time.
  • Start with the defaults and adjust per-activity speeds based on your content. A product demo might use duringIdle: 6.0 to aggressively compress waits, while a tutorial might keep everything closer to 1.0x.

On this page