Add support for videos as background images#701
Open
OneTrickSupport wants to merge 1 commit into
Open
Conversation
Background images can now be mp4 or mov files. The Settings file picker accepts videos, validates that they are playable, previews the first frame, and shows a silenceable notice about the energy cost of high-resolution, high-frame-rate files. iTermImageWrapper carries the video URL, loads a poster frame for image-only consumers, and owns one shared muted looping AVQueuePlayer per video with an AVPlayerItemVideoOutput. Consumers hold playback interests so decoding pauses when nothing is visible and panes showing the same video share a single decoder. With the GPU renderer, iTermBackgroundImageRenderer wraps each frame's pixel buffer as a BGRA Metal texture via CVMetalTextureCache, and the update cadence treats a playing video like an inline animated GIF so frames draw at display rate. Without it, an AVPlayerLayer in iTermImageView plays the video; blend, transparency, and all scaling modes apply in both paths, and playback position carries over when switching renderers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Adds support for using short videos (mp4/mov) as terminal background images, addressing the long-standing request for animated backgrounds (GitLab issue #7920).
iTermBackgroundImageRendererwraps each frame's pixel buffer as a BGRA Metal texture viaCVMetalTextureCache(zero-copy). The update cadence treats a playing video like an inline animated GIF so frames draw at display rate.AVPlayerLayeriniTermImageViewplays the video; playback position carries over seamlessly when the renderer switches because both paths share one player.iTermImageWrapperowns a single shared mutedAVQueuePlayer+AVPlayerItemVideoOutputper video and loads a poster frame for image-only consumers (blending, tiling, snapshots). Consumers hold playback interests, so decoding pauses when nothing is visible and split panes showing the same video share a single decoder.Test plan
Manually verified on macOS 26 (Apple Silicon), Xcode 26.6:
Known limitations
🤖 Generated with Claude Code