Back to Cap

Cap Recording Benchmark Results

crates/recording/BENCHMARKS.md

latest9.3 KB
Original Source

Cap Recording Benchmark Results

This document tracks performance benchmarks for Cap's recording system over time. Each benchmark run is timestamped, enabling comparison across different versions, configurations, and hardware.

Quick Reference

Performance Targets

MetricTargetTolerance
Frame Rate30 fps±2 fps
Frame Jitter<15ms-
Dropped Frames<2%-
A/V Sync (camera↔mic)<50ms-
Audio/Video Duration Diff<100ms-

Test Scenarios

  • Baseline: 5 second continuous recording
  • Single Pause: 3s record → 2s pause → 3s record (2 segments)
  • Multiple Pauses: 2s record → 1s pause → 2s record → 1s pause → 2s record (3 segments)

Running Benchmarks

bash
cargo run -p cap-recording --example real-device-test-runner -- baseline --keep-outputs --benchmark-output
cargo run -p cap-recording --example real-device-test-runner -- full --keep-outputs --benchmark-output

Benchmark History

<!-- BENCHMARK_RESULTS_START -->

Benchmark Run: 2026-01-28 11:42:54 UTC

Local time: 2026-01-28 11:42:54

Overall Result: ❌ FAILURES (0/6)

Notes: Fix #2: Display-Camera A/V sync - Sync display start time to camera/mic

Command: cargo run -p cap-recording --example real-device-test-runner -- full --keep-outputs

<details> <summary>System Information</summary>
PropertyValue
OSmacos 26.2
Architectureaarch64
CPUApple M4 Max
Display5120x1440
MicrophoneShure MV7+
CameraCamo Camera
Rust Version
</details>

Failed Tests:

  • Baseline (mp4+camera) — FRAME_RATE, AUDIO_TIMING
  • Baseline (fragmented+camera) — AUDIO_TIMING
  • Single Pause (mp4+camera) — FRAME_RATE, AUDIO_TIMING
  • Single Pause (fragmented+camera) — FRAME_RATE, AUDIO_TIMING
  • Multiple Pauses (mp4+camera) — DURATION, FRAME_RATE, AUDIO_TIMING
  • Multiple Pauses (fragmented+camera) — DURATION, FRAME_RATE, AUDIO_TIMING
<details> <summary>Detailed Results</summary>

❌ FAIL Baseline (mp4+camera)

Failure Tags: FRAME_RATE, AUDIO_TIMING

MetricResultDetails
Segments1/1 expected
Start TimesAll segments near 0
A/V Synctolerance: 50ms
↳ Seg 0 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
Duration5.11s/5.00s
Frame Rateexpected 30fps ±2
↳ Seg 0 FPS28.7fps frames=147 dropped=4 (2.7%) jitter=10.6ms
⚠️Dropped frames exceed 2%
Audio Timingtolerance: ±100ms vs video
↳ Seg 0 Mic4.98s diff=136.8ms 48000Hz 1ch
↳ Seg 0 System4.89s diff=226.8ms 48000Hz 2ch

Elapsed: 6.32s


❌ FAIL Baseline (fragmented+camera)

Failure Tags: AUDIO_TIMING

MetricResultDetails
Segments1/1 expected
Start TimesAll segments near 0
A/V Synctolerance: 50ms
↳ Seg 0 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
Duration5.04s/5.00s
Frame Rateexpected 30fps ±2
↳ Seg 0 FPS29.4fps frames=148 dropped=2 (1.3%) jitter=5.0ms
Audio Timingtolerance: ±100ms vs video
↳ Seg 0 Mic5.03s diff=12.7ms 48000Hz 1ch
↳ Seg 0 System4.92s diff=117.7ms 48000Hz 2ch

Elapsed: 5.89s


❌ FAIL Single Pause (mp4+camera)

Failure Tags: FRAME_RATE, AUDIO_TIMING

MetricResultDetails
Segments2/2 expected
Start TimesAll segments near 0
A/V Synctolerance: 50ms
↳ Seg 0 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
↳ Seg 1 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
Duration6.10s/6.00s
Frame Rateexpected 30fps ±2
↳ Seg 0 FPS29.2fps frames=89 dropped=2 (2.2%) jitter=6.6ms
⚠️Dropped frames exceed 2%
↳ Seg 1 FPS29.2fps frames=89 dropped=2 (2.2%) jitter=8.4ms
⚠️Dropped frames exceed 2%
Audio Timingtolerance: ±100ms vs video
↳ Seg 0 Mic3.02s diff=30.2ms 48000Hz 1ch
↳ Seg 0 System2.91s diff=140.2ms 48000Hz 2ch
↳ Seg 1 Mic3.02s diff=33.5ms 48000Hz 1ch
↳ Seg 1 System2.91s diff=143.5ms 48000Hz 2ch

Elapsed: 9.23s


❌ FAIL Single Pause (fragmented+camera)

Failure Tags: FRAME_RATE, AUDIO_TIMING

MetricResultDetails
Segments2/2 expected
Start TimesAll segments near 0
A/V Synctolerance: 50ms
↳ Seg 0 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
↳ Seg 1 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
Duration6.06s/6.00s
Frame Rateexpected 30fps ±2
↳ Seg 0 FPS29.5fps frames=89 dropped=1 (1.1%) jitter=5.5ms
↳ Seg 1 FPS28.9fps frames=88 dropped=3 (3.3%) jitter=12.1ms
⚠️Dropped frames exceed 2%
Audio Timingtolerance: ±100ms vs video
↳ Seg 0 Mic3.03s diff=14.9ms 48000Hz 1ch
↳ Seg 0 System2.92s diff=95.1ms 48000Hz 2ch
↳ Seg 1 Mic3.03s diff=13.8ms 48000Hz 1ch
↳ Seg 1 System2.88s diff=163.8ms 48000Hz 2ch

Elapsed: 9.10s


❌ FAIL Multiple Pauses (mp4+camera)

Failure Tags: DURATION, FRAME_RATE, AUDIO_TIMING

MetricResultDetails
Segments3/3 expected
Start TimesAll segments near 0
A/V Synctolerance: 50ms
↳ Seg 0 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
↳ Seg 1 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
↳ Seg 2 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
Duration3.78s/6.00s
Frame Rateexpected 30fps ±2
↳ Seg 0 FPS29.7fps frames=59 dropped=0 (0.0%) jitter=1.1ms
↳ Seg 1 FPS29.3fps frames=44 dropped=2 (3.3%) jitter=10.4ms
⚠️Dropped frames exceed 2%
↳ Seg 2 FPS15.3fps frames=5 dropped=4 (6.7%) jitter=44.8ms
⚠️FPS outside tolerance
⚠️Jitter exceeds 15ms
⚠️Dropped frames exceed 2%
Audio Timingtolerance: ±100ms vs video
↳ Seg 0 Mic2.00s diff=18.2ms 48000Hz 1ch
↳ Seg 0 System1.91s diff=76.8ms 48000Hz 2ch
↳ Seg 1 Mic2.00s diff=501.5ms 48000Hz 1ch
↳ Seg 1 System1.91s diff=406.5ms 48000Hz 2ch
↳ Seg 2 Mic2.00s diff=1706.5ms 48000Hz 1ch
↳ Seg 2 System1.91s diff=1611.5ms 48000Hz 2ch

Elapsed: 9.16s


❌ FAIL Multiple Pauses (fragmented+camera)

Failure Tags: DURATION, FRAME_RATE, AUDIO_TIMING

MetricResultDetails
Segments3/3 expected
Start TimesAll segments near 0
A/V Synctolerance: 50ms
↳ Seg 0 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
↳ Seg 1 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
↳ Seg 2 Synccam↔mic=0.0ms disp↔cam=0.0ms disp↔mic=0.0ms
Duration4.75s/6.00s
Frame Rateexpected 30fps ±2
↳ Seg 0 FPS7.6fps frames=6 dropped=15 (25.0%) jitter=133.5ms
⚠️FPS outside tolerance
⚠️Jitter exceeds 15ms
⚠️Dropped frames exceed 2%
↳ Seg 1 FPS25.1fps frames=49 dropped=8 (13.3%) jitter=40.0ms
⚠️FPS outside tolerance
⚠️Jitter exceeds 15ms
⚠️Dropped frames exceed 2%
↳ Seg 2 FPS17.4fps frames=34 dropped=25 (41.7%) jitter=82.1ms
⚠️FPS outside tolerance
⚠️Jitter exceeds 15ms
⚠️Dropped frames exceed 2%
Audio Timingtolerance: ±100ms vs video
↳ Seg 0 Mic2.02s diff=1141.3ms 48000Hz 1ch
↳ Seg 0 System1.92s diff=1046.3ms 48000Hz 2ch
↳ Seg 1 Mic2.02s diff=70.5ms 48000Hz 1ch
↳ Seg 1 System1.92s diff=24.5ms 48000Hz 2ch
↳ Seg 2 Mic2.02s diff=83.0ms 48000Hz 1ch
↳ Seg 2 System1.90s diff=32.0ms 48000Hz 2ch

Elapsed: 9.18s


</details> <!-- BENCHMARK_RESULTS_END -->

Analysis Guidelines

When analyzing benchmark results, focus on:

  1. Regression Detection: Compare current results with previous runs to identify performance regressions
  2. Pattern Recognition: Look for consistent failures across test types (e.g., always fails on fragmented output)
  3. Environmental Factors: Note hardware differences, system load, or configuration changes
  4. Root Cause Analysis: Use failure tags to identify which subsystem needs attention

Common Issues & Solutions

IssuePossible CausesInvestigation Steps
Low FPSEncoder bottleneck, CPU loadCheck encoding timing metrics
High JitterThread contention, GC pausesProfile frame timestamps
Dropped FramesBuffer overflow, slow encodingCheck pipeline metrics
A/V Sync DriftClock source mismatchVerify timestamp alignment
Audio GapsBuffer underrun, device issuesCheck audio stream continuity