Skip to content

Record the viewport video from a visualizer with Isaac Lab's VideoRecorder - #1808

Merged
xyao-nv merged 11 commits into
mainfrom
xyao/fix/viewport_video_recording
Dec 1, 2026
Merged

xyao-nv merged 11 commits into
mainfrom
xyao/fix/viewport_video_recording

Conversation

@xyao-nv

@xyao-nv xyao-nv commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Fix --record_viewport_video, which wrote no video, by recording with Isaac Lab's VideoRecorder.

Why this change?

--record_viewport_video used Gymnasium's RecordVideo, which captures frames from env.render(). Isaac Lab 3.0 no longer renders render_mode="rgb_array" frames, and env.render() returns None. So both runners printed "Recording ... viewport video", wrote nothing, and exited 0.

What changes?

  • Record from a visualizer with Isaac Lab's VideoRecorder, and add a headless Kit visualizer when --viz is omitted.
  • Fail with a clear message under --viz none, which disables all visualizers. The OSMO task no longer passes --viz none when it records the viewport.

Validation

  • Recording runs with policy_runner.py --policy_type zero_action --num_steps 30 cube_goal_pose:
    • Before this change, --record_viewport_video wrote no MP4, with or without --viz kit, and exited 0.
    • Now, without --viz, it writes viewport_0000.mp4: 30 frames at 1280x720, showing the Franka, the table, and the cube.
    • With --viz none, it exits 1 within 2 s, before Isaac Sim starts, with the new message and no MP4.
  • Subprocess tests check that the policy runner and each Experiment Runner rebuild write an MP4 with drawn frames. In-process tests check the --viz none error.
  • Known limit: the recorder holds a clip's frames in memory, so very long clips can use several GB.

…order

--record_viewport_video wrapped the env in Gymnasium's RecordVideo, but
Isaac Lab 3.0's env.render() returns None for render_mode="rgb_array".
The policy runner and the Experiment Runner printed "Recording ...
viewport video", wrote no MP4, and exited 0.

Record with Isaac Lab's VideoRecorder instead, as Isaac Lab's own --video
does. The recorder captures frames from a visualizer:

- Without --viz, add a headless Kit visualizer to the environment config
  before the environment is made. No window opens.
- Under --viz none, which disables every visualizer, fail with a message
  that says to omit --viz or pass --viz kit.
- Check up front that an active visualizer can capture frames. The
  recorder only logs a capture error and writes no clip.
- Load the renderer at app launch for viewport recording, as
  --record_camera_video does. The environment still gets no cameras
  unless --enable_cameras is passed.

The policy runner writes viewport_0000.mp4. The Experiment Runner writes
viewport-rebuild<i>_0000.mp4 for each rebuild. The OSMO Experiment Runner
task omits --viz none when it records the viewport. The review GUI's sim
preview no longer reads the removed VideoRecordingCfg.render_mode.

Add unit tests for the visualizer and recorder setup, and subprocess tests
that check the policy runner writes a rendered MP4, rejects --viz none, and
that each Experiment Runner rebuild writes its own viewport MP4. Update the
inspect-sim-visually and run-experiment skills and the v0.4 migration guide.

Signed-off-by: Xinjie Yao <[email protected]>
@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5RetriggerView in Greptile

[Medium impact] The changes affect viewport recording in several bounded rollout workflows.

The PR appears safe to merge, with a non-blocking correction needed for simulation timing.

Findings

  1. P2 Video work skews simulation timings ▶

Summary

Replaces Gymnasium viewport recording with Isaac Lab's VideoRecorder.

  • Viewport recording now captures rendered frames from a visualizer.
  • Experiment rebuilds now save separate viewport clips.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Viewport recording requested] --> B{Visualizer choice}
  B -->|none| C[Fail with clear message]
  B -->|Not specified| D[Add headless Kit visualizer]
  B -->|Explicit choice| E[Keep requested visualizers]
  D --> F[Build environment]
  E --> F
  F --> G[Check frame capture support]
  G --> H[Attach VideoRecorder]
  H --> I[Record during environment steps]
  I --> J[Write clip at length limit or close]
Loading

Reviews (1) · Last reviewed commit: "Record the viewport video from a visuali..." · Reviewed by Greptile

Comment thread isaaclab_arena/video/video_recording.py Resolved
Comment thread isaaclab_arena/video/video_recording.py Resolved
Comment thread isaaclab_arena/video/video_recording.py Resolved
@arena-review-bot

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR fixes --record_viewport_video, which silently wrote no MP4 because Isaac Lab 3.0's render() returns None for rgb_array. Recording now goes through Isaac Lab's VideoRecorder with source="visualizer". add_viewport_visualizer adds a headless Kit visualizer when --viz is omitted and fails loudly under --viz none. I checked this against the pinned Isaac Lab code (e3f7d9f):

  • The settings keys match.
  • With --viz omitted, the configured visualizers are used, and the task's default_visualizer_cfg camera pose still applies to the added Kit visualizer.
  • sim.visualizers is populated by the time gym.make returns.
  • The env steps and flushes its recorders.
  • Forcing camera support at launch is needed, because Kit's frame capture needs the rendering app profile.

The comments below are small improvements.

Design, Boundaries & Scope

Isaac Lab's own --video path does the same setup in two steps before gym.make. pre_launch_video_config / _inject_headless_kit_visualizer in isaaclab_rl/entrypoints/common.py add a headless Kit visualizer, and apply_video_recording sets env_cfg.video_recorders. This PR copies the first step; the copy is reasonable because the upstream helper is private, and the PR handles a single, non-list visualizer config better than upstream does. For the second step, though, it appends a VideoRecorder to the built env's video_recorders list. Since both runners already edit env_cfg before gym.make, could the recorder config go there too? The env would then create the recorder and run VideoRecorderCfg.validate_config(), and all viewport setup would happen in one place. The catch is ordering: video_length needs the rollout limit, which is resolved after the env is built today, although neither runner's policy construction needs the env.

Findings

🔵 Improvement: isaaclab_arena/video/video_recording.py:96: the recorder is added after the env is built, which skips Isaac Lab's config validation (see above).

🔵 Improvement: isaaclab_arena/tests/test_experiment_runner.py:317: the per-rebuild test only checks file names. VideoRecorder still writes a clip when every frame is black, so a broken second rebuild (Kit visualizer re-created in the same app) would pass. Reusing the frame-brightness check from the policy runner test would cover this.

🔵 Improvement: isaaclab_arena/tests/test_policy_runner.py:144: test_record_viewport_video_rejects_viz_none starts Isaac Sim and builds the environment config to check an assertion that test_add_viewport_visualizer_rejects_viz_none already covers. Could the runners reject --viz none together with --record_viewport_video before SimulationAppContext starts?

🔵 Improvement: isaaclab_arena/video/video_recording.py:152: viewport frame capture now runs inside env.step(), so it counts toward the sim_step timer. The existing "without-recording step measurement" comment no longer holds for viewport recording.

🔵 Improvement: isaaclab_arena/tests/test_video_recording.py:99: imageio and numpy are imported inside test bodies. Neither needs Isaac Sim, so both can go at the top of the file.

Possible follow-up outside this diff: after this change, no production code passes render_mode to ArenaEnvBuilder.make_registered(). The only remaining caller is test_background_physics_reset_cameras.py:28, which passes the deprecated "rgb_array" and never calls render().

Test Coverage and CI Cost

  • The new end-to-end tests are in the right phase (with_subprocess). The policy runner MP4 test is the one check that real capture works, and it should stay.
  • The --viz none subprocess test adds a full Isaac Sim startup to Phase 3 (see the inline comment).
  • I did not see CI results for this run.

Verdict

Ship it

Number the steps in add_viewport_visualizer and _add_viewport_video_recorder,
and note where they follow Isaac Lab's --video setup and where they differ.

Signed-off-by: Xinjie Yao <[email protected]>
The policy runner, the Experiment Runner and the review GUI's sim preview
each added the viewport visualizer to the environment config and then
made the environment. make_registered_env_for_video does both, so the
visualizer is always added before the simulation creates its
visualizers. add_viewport_visualizer is now private.

Signed-off-by: Xinjie Yao <[email protected]>
Check for viewport recording in the helper itself, so without it the
helper is plain make_registered: camera recording needs no visualizer.
_add_viewport_visualizer now only chooses whether to add the headless
Kit visualizer. Add a test that the helper adds no visualizer when only
cameras, or nothing, is recorded.

Signed-off-by: Xinjie Yao <[email protected]>
- Reject --record_viewport_video with --viz none in both runners before
  Isaac Sim starts. The policy runner test now runs in-process, and the
  Experiment Runner has a matching test.
- Validate the recorder config with VideoRecorderCfg.validate_config(),
  as the environment does for recorders declared on its config.
- Note that sim_step includes viewport frame capture, because Isaac
  Lab's recorder runs inside env.step().
- Check that each Experiment Runner rebuild's video has rendered frames.
- Import imageio and numpy at the top of the test files.

Signed-off-by: Xinjie Yao <[email protected]>
…ions

The bullet above it already covers capturing the default view, and the
skill's pitfall table covers env.render() returning no image.

Signed-off-by: Xinjie Yao <[email protected]>
…e viewport

Replace make_registered_env_with_viewport_visualizer with separate steps,
so making the environment stays the builder's generic make_registered.
The policy runner and the Experiment Runner call add_viewport_visualizer
only when they record the viewport; camera recording needs none. The
review GUI's sim preview always records the viewport, so it always adds
one. The call-site test now also covers camera-only recording.

Signed-off-by: Xinjie Yao <[email protected]>
Both runners reject --viz none before Isaac Sim starts, and the recorder
setup fails when no visualizer can capture frames, so drop the second
--viz none check. SimulationCfg.visualizer_cfgs defaults to an empty
list, so skip when --viz picks the visualizers or the config declares
any, and otherwise set a headless Kit visualizer. Leave the reason the
old recorder captured nothing to the pull request description.

Signed-off-by: Xinjie Yao <[email protected]>
…kill

The skill now names only what records the viewport: --record_viewport_video
and how to run it with a visualizer. Remove the env.render() trigger from
its description and the env.render() row from its pitfall table.

Signed-off-by: Xinjie Yao <[email protected]>
The --viz none check before launch and the frame-capture check after the
environment is made catch different cases, so both stay. They now share
the advice to omit --viz or pass --viz kit, and the capture check is a
single any() assert.

Signed-off-by: Xinjie Yao <[email protected]>

@peterd-NV peterd-NV left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One non blocking comment

Comment thread isaaclab_arena/video/video_recording.py Resolved
@xyao-nv
xyao-nv merged commit 3c31f70 into main Dec 1, 2026
10 checks passed
xyao-nv added a commit that referenced this pull request Dec 2, 2026
…ab's VideoRecorder (#1808) (#1812)

Cherry-pick #1808 into `release/0.4.0`, so `--record_viewport_video`
writes a viewport video on the release branch.

---------

Signed-off-by: Xinjie Yao <[email protected]>
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.

2 participants