Skip to content

Fix Safari iOS video time scale#2457

Merged
soulgalore merged 1 commit intomainfrom
ios-capture-60fps
May 5, 2026
Merged

Fix Safari iOS video time scale#2457
soulgalore merged 1 commit intomainfrom
ios-capture-60fps

Conversation

@soulgalore
Copy link
Copy Markdown
Member

When recording an iPhone over USB the captured video used to play back at half wall-clock speed, which made every visualmetrics-derived metric (FirstVisualChange, VisualComplete85, LastVisualChange and the filmstrip frame timestamps) drift away from the browser metrics that sitespeed.io renders alongside them. On the visual progress card you could see FCP and LCP markers landing in completely different places than the matching filmstrip thumbnails — the symptom that prompted this fix.

The reason is that AVFoundation delivers iOS screen-capture frames at the device's display refresh rate, and ios-capture was telling its ffmpeg encoder the input was 30 fps regardless. Encoding 60 frames per real second as a 30 fps stream stretches the timeline by 2x.

This change defaults ios-capture and the Safari driver to 60 fps so the encoded video matches the device's actual delivery rate. ProMotion devices may need a follow-up with PTS-correct frames via AVAssetWriter, but for 60 Hz iPhones the timelines now line up to within one frame.

Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com
Change-Id: I265ca6fe8e3cccfaa88234be3cfb4a5a2ec70b75

When recording an iPhone over USB the captured video used to play
back at half wall-clock speed, which made every visualmetrics-derived
metric (FirstVisualChange, VisualComplete85, LastVisualChange and the
filmstrip frame timestamps) drift away from the browser metrics that
sitespeed.io renders alongside them. On the visual progress card you
could see FCP and LCP markers landing in completely different places
than the matching filmstrip thumbnails — the symptom that prompted
this fix.

The reason is that AVFoundation delivers iOS screen-capture frames at
the device's display refresh rate, and ios-capture was telling its
ffmpeg encoder the input was 30 fps regardless. Encoding 60 frames
per real second as a 30 fps stream stretches the timeline by 2x.

This change defaults ios-capture and the Safari driver to 60 fps so
the encoded video matches the device's actual delivery rate. ProMotion
devices may need a follow-up with PTS-correct frames via AVAssetWriter,
but for 60 Hz iPhones the timelines now line up to within one frame.

Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com
Change-Id: I265ca6fe8e3cccfaa88234be3cfb4a5a2ec70b75
@soulgalore soulgalore merged commit 8ad1c9d into main May 5, 2026
16 checks passed
@soulgalore soulgalore deleted the ios-capture-60fps branch May 5, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant