You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: keep macOS webcam recordings continuous with VP8 - #1297
On macOS, MediaRecorder's H.264 webcam encoder can stop producing frames while the camera stream stays live. A local reproduction with a Logitech C922 produced only 13 frames over 56 seconds; VP8 produced 3,828 frames over 128 seconds with a maximum frame gap of 68 ms. A second installed-build take produced 1,932 frames over 64 seconds, maximum gap 66 ms.
Prefer VP8 for macOS webcam recording, independently of the native H.264 screen recorder. Keep the existing H.264 preference on Windows/Linux and negotiate supported fallbacks. Check the codec's VideoToolbox configurations before selecting hardware presentation: VP8 CPU frames need the existing NV12/CVPixelBuffer conversion to appear in the Metal compositor. Preserve unknown-sized WebM Cluster bytes when patching duration, including recordings under 2 MB.
The machine-specific build/install scripts used for local testing are excluded. Autofocus and camera constraints are unchanged. The held-screen preview clock fixes already on main address a separate editor-only freeze.
Related issue
No issue linked; reproduced locally on macOS.
Type of change
Bug fix
Release impact
Patch
Desktop impact
macOS
Screenshots / video
Private camera recordings were checked locally and are not attached. The testing checklist records the measured continuity and the partial desktop smoke-test scope.
Testing
Node 22: full unit suite, 351 files; 4,909 passed, 2 skipped.
Biome check of the five changed TypeScript files passes.
Native codec regression test passes: VP8 uses CPU presentation; H.264 advertises VideoToolbox.
Release compositor addon builds on Apple Silicon with the vendored LGPL FFmpeg SDK.
Capture-to-editor and MP4 camera presentation tested on the v2.0.0 local build carrying this patch. The port to current main has unit/type/build checks; a new desktop capture smoke test on that exact main build and physical Windows/Linux capture were not run.
Summary by CodeRabbit
Bug Fixes
Improved webcam recording compatibility across macOS, Windows, and Linux by selecting an available video format for each platform.
Webcam recording bitrate now reflects the camera’s delivered dimensions.
Fixed duration updates for WebM recordings of all sizes while preserving their video data.
Unsupported hardware-decoding formats on macOS now use the CPU presentation path, supporting preview and export.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
The changes update platform-specific webcam codec selection, route all on-disk WebM duration patches through a header-only splice path, and gate macOS VideoToolbox setup on codec support. Tests cover codec selection, WebM byte preservation, and decoder support.
The new helper selects codecs in platform-specific order, omits mimeType when no candidate is supported, and sets the bitrate from delivered camera dimensions. The screen recorder uses this helper. Tests cover codec preferences, fallback, and bitrate.
Files of all sizes now use the header-only splice path. Tests check patching a file under 2 MB and preservation of Cluster bytes after duration patching.
VideoToolbox setup is attempted only when the codec supports the device type and pixel format. Tests check VP8 and H.264 support. The manual test log records macOS capture results and remaining test gaps.
The camera-recording changes are ready to merge after normal checks; no concrete blocking issue remains identified.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 6 files. (1 skipped: 1…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title clearly states the primary bug fix: keeping macOS webcam recordings continuous by using VP8.
Description check
The description follows the repository template and covers the summary, issue status, change type, release impact, platform impact, testing, and known test limitations.
Full details: Docstring Coverage
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 6 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
This branch has not been deployed
No deployments
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
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.
Summary
On macOS, MediaRecorder's H.264 webcam encoder can stop producing frames while the camera stream stays live. A local reproduction with a Logitech C922 produced only 13 frames over 56 seconds; VP8 produced 3,828 frames over 128 seconds with a maximum frame gap of 68 ms. A second installed-build take produced 1,932 frames over 64 seconds, maximum gap 66 ms.
Prefer VP8 for macOS webcam recording, independently of the native H.264 screen recorder. Keep the existing H.264 preference on Windows/Linux and negotiate supported fallbacks. Check the codec's VideoToolbox configurations before selecting hardware presentation: VP8 CPU frames need the existing NV12/CVPixelBuffer conversion to appear in the Metal compositor. Preserve unknown-sized WebM Cluster bytes when patching duration, including recordings under 2 MB.
The machine-specific build/install scripts used for local testing are excluded. Autofocus and camera constraints are unchanged. The held-screen preview clock fixes already on main address a separate editor-only freeze.
Related issue
No issue linked; reproduced locally on macOS.
Type of change
Release impact
Desktop impact
Screenshots / video
Private camera recordings were checked locally and are not attached. The testing checklist records the measured continuity and the partial desktop smoke-test scope.
Testing
Summary by CodeRabbit