Skip to content

Add start/end frame range support to -n argument#68

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-command-line-argument-frames
Draft

Add start/end frame range support to -n argument#68
Copilot wants to merge 2 commits intomasterfrom
copilot/add-command-line-argument-frames

Conversation

Copy link

Copilot AI commented Mar 5, 2026

The -n flag only supported processing from frame 0 up to N frames. Users had no way to extract a mid-sequence snippet without processing from the beginning.

Changes

  • cli.py: -n now accepts 1 or 2 integers via nargs="+":

    • -n N — process first N frames (backward-compatible)
    • -n START END — process frames START to END inclusive
    • Validates START >= 0 and END >= START; converts to (start_image_idx, count) before passing downstream
  • core.py: Core.__init__ gains a start_image_idx: int = 0 parameter; num_images and max_img_id are adjusted accordingly; corrected_points2d_matrix iterates the correct frame range

  • video.py: make_pose2d_video and make_pose3d_video gain start_image_idx=0; generators iterate range(start_image_idx, start_image_idx + num_images)

  • tests/test_df3d.py: Tests for Core with start_image_idx, and for all three CLI -n forms

Example

# Old behavior preserved
df3d-cli /data/images -n 50

# New: process only frames 25–50 inclusive
df3d-cli /data/images -n 25 50 --video-2d
Original prompt

This section details on the original issue you should resolve

<issue_title>Add command line argument - video start and end frames</issue_title>
<issue_description>Right now the df3d video making options include only -n (number of frames) - which means make a video from frame 0 to n.
It would be great to be able to specify the starting frame n0 and the end frame n1 instead, to make a video for a particular snippet and not just the start</issue_description>

Comments on the Issue (you are @copilot in this section)

@jasper-tms Perhaps we can keep `-n 50` as "process the first 50 frames" but expand it so that `-n 25 50` (two numbers instead of one number passed after `-n`) would mean "process frame 25 to frame 50". How does that sound? @azmaite Sounds good to me, that way it is back-compatible with anyone's older code.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- cli.py: Change -n to accept 1 or 2 values (nargs='+')
  - -n N: process first N frames (backward compatible)
  - -n START END: process frames START to END inclusive
- core.py: Add start_image_idx parameter to Core.__init__
- video.py: Add start_image_idx to make_pose2d/3d_video functions
- tests: Add tests for new functionality and CLI parsing

Co-authored-by: jasper-tms <23616964+jasper-tms@users.noreply.github.com>
Copilot AI changed the title [WIP] Add command line argument for video start and end frames Add start/end frame range support to -n argument Mar 5, 2026
@jasper-tms
Copy link
Member

Hey @Dominic-DallOsto the df3d tests are failing because like 1% of the pixels in the newly generated videos have values that are slightly different from the videos in the repo. I think this doesn't reflect problems with the code but just slight differences in video encoding that aren't problematic. Do you have any ideas for how we could generalize the testing framework to be robust to this?

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.

Add command line argument - video start and end frames

2 participants