Skip to content

fix: improve video capture quality for HDMI capture cards#34

Merged
BernardJen merged 2 commits into
mainfrom
fix/video-image-quality
Apr 16, 2026
Merged

fix: improve video capture quality for HDMI capture cards#34
BernardJen merged 2 commits into
mainfrom
fix/video-image-quality

Conversation

@BernardJen
Copy link
Copy Markdown
Contributor

Summary

  • Fix leaked MediaStream in getVideoDevices() — the permission request stream was never stopped, locking capture cards (e.g. Elgato Cam Link 4K) at 640x480 before the actual stream could negotiate a proper resolution
  • Remove image-rendering: -webkit-optimize-contrast which forced pixelated nearest-neighbor scaling; replaced with high-quality and GPU filter pipeline rendering
  • Add frameRate: { ideal: 60 } to all getUserMedia constraints and cap resolution retry at 1920x1080 to prefer uncompressed formats over MJPEG
  • Remove GPU flags (enable-accelerated-mjpeg-decode, enable-native-gpu-memory-buffers) that interfered with UVC device format negotiation

Test plan

  • Verify Elgato Cam Link 4K (or similar USB capture card) captures at native HDMI input resolution instead of 640x480
  • Check console logs show correct resolution after stream starts
  • Verify video scaling quality is smooth (not pixelated) when displayed at non-native size
  • Test dual and single view modes
  • Test device hot-plug (disconnect/reconnect capture card)

🤖 Generated with Claude Code

BernardJen and others added 2 commits April 16, 2026 17:24
The main issue was a leaked MediaStream from the permission request in
getVideoDevices() — the stream was never stopped, which locked the
capture card (e.g. Elgato Cam Link 4K) at its default 640x480 resolution
before startVideoStream could request a proper resolution.

Additional fixes:
- Remove image-rendering: -webkit-optimize-contrast which forced
  nearest-neighbor (pixelated) scaling on the video element
- Add image-rendering: high-quality and filter: contrast(1) to use
  Chromium's GPU filter pipeline with better interpolation
- Add frameRate: { ideal: 60 } to all getUserMedia constraints
- Cap resolution retry at 1920x1080 to prefer uncompressed formats
  over MJPEG on USB capture cards
- Remove GPU flags (enable-accelerated-mjpeg-decode,
  enable-native-gpu-memory-buffers) that could interfere with
  UVC device format negotiation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Required by repo policy — pin all actions to their v4/v2 commit SHAs
instead of version tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BernardJen BernardJen merged commit 75c56d7 into main Apr 16, 2026
6 checks passed
@BernardJen BernardJen deleted the fix/video-image-quality branch April 16, 2026 15:48
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