Skip to content

Improve Capture Video window - #229

Open
todi1856 wants to merge 67 commits into
masterfrom
livestream-video
Open

todi1856 wants to merge 67 commits into
masterfrom
livestream-video

Conversation

@todi1856

@todi1856 todi1856 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Yamato CI

Purpose of PR

Type of change: Improvement to Video Capture

https://jira.unity3d.com/browse/PLAT-23512

Screen recordings in the Screen Capture window are now made from the live stream, and can be played back in the window.

image image

https://www.youtube.com/watch?v=exqVXgTFjNU&feature=youtu.be

Highlights

  • Recording from the live stream
    • The live view's JPEG frames are encoded straight to MP4 with UnityEditor.Media.MediaEncoder, replacing adb screenrecord.
    • Output is constant frame rate (H.264 Baseline), at the live stream's Max Frame Rate, now capped at 60.
    • A still screen is still recorded: the last frame is repeated as time passes.
    • Follows the live view's rotation.
    • Decoding and encoding run within a time budget on each Editor update, so the Editor stays responsive.
    • A red REC timer shows over the live view while recording.
  • Recording time limit in Preferences (default 10 minutes, max 60). A recording also stops and is saved when the stream ends, the device changes, or scripts reload.
  • Square Video in Preferences (on by default): the video is a square of the stream's longest side, so turning the device or unfolding a foldable keeps the picture at full size. On foldables the other screen's size is read from dumpsys display.
  • Record Touches in Preferences (on by default): clicks and drags sent from the live view are saved with the recording, and drawn as coloured markers during playback (Android does not draw injected touches itself).
  • Per-frame metadata in the recording's .json, as frameChanges over time:
    • the device's display size, shown in the details column at the current playback time;
    • where the picture sits in the video, so playback crops out the black areas;
    • the recorded touches. Built to take logcat messages later.
  • Video player for recordings in the capture list:
    • opens paused;
    • play/pause, a time slider (dragging pauses and resumes, like YouTube) and frame step back/forward;
    • Frame Rate shown in the details column, which stays put while the picture changes shape.
    • Built around an explicit state machine, with a state history in Developer Mode.
  • Capture list
    • Disabled while recording.
    • A finished recording flashes in the list like a screenshot instead of being selected.
    • Rename and delete work on recordings too.
  • Domain reload
    • The window keeps its selection, the video position, and the zoom of both views.
    • The live stream's cleanup no longer hangs the "Reloading Domain" dialog.
  • Zoom badge has a right-click menu with fixed zoom levels (100%–4000%), and is easier to read.
  • Profiler markers (AndroidLogcat.*) for the recording and live stream hot paths.

Halo effect

Screen Capture window: live view, capture list, screenshots. adb screenrecord is no longer used. Linux has no H.264 encoder or player, so recording and playback are unavailable there, and the video tests are skipped.

Testing status

  • New AndroidLogcatVideoPlayerTests. Test videos are generated at test time with MediaEncoder. They cover opening, play/pause, stepping, seeking while paused and while playing, resuming, single-frame videos, and rename/delete of the previewed recording.
  • New AndroidLogcatStreamRecorderTests: frame changes of frames still queued keep their time after a later touch.
  • Integration tests record from the live stream (CanRecordTheLiveStream, RecordingNeedsTheLiveStream).
  • Tested manually on Windows with Android devices, including high resolution and 60 fps streams.

🤖 Generated with Claude Code

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

The change unifies screenshots and recordings in the live capture workflow, but the recording lifecycle and shared file operations need corrections.

P1

Renaming a recording changes its extension to .png, so the capture preview can no longer play it. The newly listed recordings use RenameScreenshot, which constructs the destination with GetImageExtension() rather than preserving the source extension. SyncPreview then sends the renamed MP4 bytes to Texture2D.LoadImage because IsVideo returns false. Construct the destination with Path.GetExtension(path). Use that extension in the collision message.

Reviewed commit 01c3eef

🤖 Helpful? 👍/👎

todi1856 and others added 16 commits October 23, 2026 18:59
A screenrecord capture with a variable frame rate and a single keyframe,
which AndroidLogcatVideoPlayerTests play, step and seek through. Marked
binary in .gitattributes, which otherwise normalizes every file as text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@todi1856

Copy link
Copy Markdown
Member Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

Recordings now share the capture list and gain an interactive preview, but the new playback and storage paths still have correctness gaps.

Reviewed commit 9d58996

🤖 Helpful? 👍/👎

@todi1856

Copy link
Copy Markdown
Member Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

The change integrates live-stream recording and video previews into the capture list, but encoder failures can leave the interface displaying an active recording that is no longer producing frames.

Reviewed commit 1090ca4

🤖 Helpful? 👍/👎

@todi1856

Copy link
Copy Markdown
Member Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Ship it

The change replaces device-side video capture with live-stream recording and integrates playback into the capture list. I examined recording lifecycle, frame timing, preview controls, file operations, and reload restoration, and found no new actionable issues beyond those previously reported.

Reviewed commit e2cef57

⚠️ Earlier blocking findings with unresolved threads: 2. The rating above does not cover them; resolve each thread after addressing it. Earlier blocking summary findings: 1. The rating above does not cover them; after addressing each one, hide the review that posted it.

🤖 Helpful? 👍/👎

@todi1856

Copy link
Copy Markdown
Member Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

The change integrates live-stream recording with capture-list playback, with a correctness issue in the new recording metadata timeline.

Reviewed commit cc42acf

🤖 Helpful? 👍/👎

Comment on lines +390 to +391
if (last != null && last.time >= time)
return last;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1

When a rotated frame is decoded after a later touch is logged, playback crops the rotated frame using the previous content rectangle. The recorder’s update budget allows queued frames to remain while live-view input logs touches. NoteTouch timestamps changes using NowUs, while Decode timestamps metadata using the frame’s recording slot. ChangeAt returns the latest entry for any earlier timestamp, so NoteContent can move a queued frame’s crop change to the later touch time. Display-size changes are delayed similarly. Insert changes in timestamp order. Merge entries only when their timestamps match.

🤖 Helpful? 👍/👎

@todi1856

Copy link
Copy Markdown
Member Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Ship it

The change replaces device-side recording with live-stream encoding and adds playback controls and selection restoration. I examined recording timing, preview behavior, capture operations, and lifecycle handling, and found no new issues beyond those previously reported.

Reviewed commit af3a26e

⚠️ Earlier blocking findings with unresolved threads: 1. The rating above does not cover them; resolve each thread after addressing it. Earlier blocking summary findings: 1. The rating above does not cover them; after addressing each one, hide the review that posted it.

🤖 Helpful? 👍/👎

@todi1856 todi1856 changed the title Livestream video Improve Capture Video window Oct 30, 2026
@todi1856
todi1856 requested review from a team and BorisShir October 30, 2026 15:24
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