Skip to content

Continue video clip indices after existing files - #7391

Merged
kellyguo11 merged 1 commit into
isaac-sim:developfrom
diegoferigo-rai:diegoferigo/video-recorder-continue-indices
Sep 3, 2026
Merged

Continue video clip indices after existing files#7391
kellyguo11 merged 1 commit into
isaac-sim:developfrom
diegoferigo-rai:diegoferigo/video-recorder-continue-indices

Conversation

@diegoferigo-rai

@diegoferigo-rai diegoferigo-rai commented Aug 27, 2026

Copy link
Copy Markdown

Description

VideoRecorder starts its clip index at zero on every new process, so a run that records into a directory that already holds clips overwrites clip_0000.mp4 onward. This scans the output directory for existing <prefix>_<N>.mp4 files and continues the clip index after the highest one, so successive runs into the same directory no longer clobber earlier recordings.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added documentation Improvements or additions to documentation asset New asset feature or request isaac-mimic Related to Isaac Mimic team infrastructure labels Aug 27, 2026
@diegoferigo-rai
diegoferigo-rai changed the base branch from develop to release/3.0.0 August 27, 2026 16:46
@diegoferigo-rai
diegoferigo-rai marked this pull request as ready for review August 27, 2026 16:51
@diegoferigo-rai
diegoferigo-rai requested a review from a team August 27, 2026 16:51
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prevents sequential recorder processes from overwriting existing clips by initializing the clip counter after the largest matching filename.

  • Adds prefix-aware scanning of existing MP4 filenames during recorder initialization.
  • Adds unit coverage for populated and empty output directories.
  • Adds a changelog entry and contributor attribution.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking scalability issue when a reused directory contains an unusually large sparse clip index and retention pruning is enabled.

Existing filenames can now initialize the counter to an arbitrarily large value, while retention cleanup still enumerates every lower integer rather than only existing files.

Files Needing Attention: source/isaaclab/isaaclab/envs/utils/video_recorder.py

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/envs/utils/video_recorder.py Continues numbering after existing clips, but a sparse high index can make range-based retention cleanup perform an effectively unbounded number of filesystem operations.
source/isaaclab/test/envs/test_video_recorder.py Covers selecting the next index from matching files and retaining zero for an empty directory.
source/isaaclab/changelog.d/video-recorder-continue-indices.rst Accurately documents the overwrite-prevention fix.

Reviews (1): Last reviewed commit: "Continue video clip indices after existi..." | Re-trigger Greptile

Comment thread source/isaaclab/isaaclab/envs/utils/video_recorder.py Outdated

@isaaclab-review-bot isaaclab-review-bot 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.

Isaac Lab Review Bot

The change seeds VideoRecorder clip numbering from the highest existing matching <prefix>_<index>.mp4 file, preventing successive processes from restarting at zero. Focused tests cover sparse matching files, ignored non-matching files, and an empty output directory; release metadata is included.

  • Design and architecture: Index discovery remains within the recorder’s existing filesystem boundary and reuses _effective_output_dir() and the established filename convention. _close_clip() continues incrementing the seeded index through the existing path without broader architectural changes.
  • API: No public API is added or removed. The private initial index behavior changes intentionally, while VideoRecorderCfg, defaults, and the output filename format remain unchanged. The user-visible fix is documented in the package changelog fragment.
  • Implementation: The constructor assigns self.cfg before scanning, the anchored and escaped regex limits matches to the configured prefix and numeric MP4 filenames, and missing or empty directories preserve the prior zero start. A non-blocking tradeoff is that construction now lists an existing output directory, so permission or filesystem errors can surface during initialization rather than later as logged write failures.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@diegoferigo-rai
diegoferigo-rai force-pushed the diegoferigo/video-recorder-continue-indices branch from 621ec7e to 81c0b31 Compare August 27, 2026 17:11
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Aug 27, 2026
@AntoineRichard

Copy link
Copy Markdown
Collaborator

Could you target develop? We'll backport them to release 3.0

@diegoferigo-rai

diegoferigo-rai commented Aug 28, 2026

Copy link
Copy Markdown
Author

Retargeted to develop, thanks!

Previously, VideoRecorder started every process at clip index zero. Recording into an existing output directory could overwrite clip_0000.mp4 and any later clips from a previous play or replay run.

Initialize the recorder index from the highest existing file matching the configured prefix. Fresh or empty directories still start at zero.
@AntoineRichard

Copy link
Copy Markdown
Collaborator

@kellyguo11 @matthewtrepte could I get a review?

@kellyguo11

Copy link
Copy Markdown
Contributor

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 3, 2026
@kellyguo11

Copy link
Copy Markdown
Contributor

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 3, 2026
@kellyguo11

Copy link
Copy Markdown
Contributor

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 3, 2026
@kellyguo11
kellyguo11 merged commit 5615143 into isaac-sim:develop Sep 3, 2026
42 of 60 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as e9b6ab5.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 3, 2026
# Description

`VideoRecorder` starts its clip index at zero on every new process, so a
run that records into a directory that already holds clips overwrites
`clip_0000.mp4` onward. This scans the output directory for existing
`<prefix>_<N>.mp4` files and continues the clip index after the highest
one, so successive runs into the same directory no longer clobber
earlier recordings.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the `pre-commit` checks with `./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

(cherry picked from commit 5615143)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asset New asset feature or request documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants