Fix Safari iOS video time scale#2457
Merged
soulgalore merged 1 commit intomainfrom May 5, 2026
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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