feat: add GetVideoLastFrame node (CORE-123)#13602
Conversation
Signed-off-by: bigcat88 <bigcat88@icloud.com>
📝 WalkthroughWalkthroughThis pull request adds a new 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests-unit/comfy_extras_test/nodes_video_test.py (1)
298-301: Tighten the corrupt-input expectation.
pytest.raises(Exception)is very broad and can pass on unrelated regressions. Prefer asserting a narrower failure condition (specific error text or bounded exception set) so this test catches the right failure mode.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests-unit/comfy_extras_test/nodes_video_test.py` around lines 298 - 301, Change the test to assert a narrower failure: replace pytest.raises(Exception) in test_corrupt_bytes_raises with a specific exception type thrown by GetVideoLastFrame.execute for invalid input (e.g., pytest.raises(ValueError)) and optionally add a match argument to assert the error message contains a distinguishing substring like "corrupt" or "decode"; locate this in the test function test_corrupt_bytes_raises which constructs the bad input via InputImpl.VideoFromFile(io.BytesIO(...)) and calls GetVideoLastFrame.execute(video).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@comfy_extras/nodes_video.py`:
- Around line 200-203: The fixed 0.003s tolerance used when comparing
raw_duration_us/av.time_base to reported_duration_s can mis-detect trims for
high-FPS sources; replace the magic constant with a frame-rate-aware tolerance
by querying the stream frame rate (e.g., use av.average_rate or av.rate),
compute frame_duration_s = 1.0 / float(frame_rate) (fallback to a sensible
default if unavailable), then set threshold = min(0.003, 0.5 * frame_duration_s)
and use that threshold in the existing comparison using raw_duration_us,
av.time_base and reported_duration_s so tiny per-frame offsets at high FPS are
handled correctly.
---
Nitpick comments:
In `@tests-unit/comfy_extras_test/nodes_video_test.py`:
- Around line 298-301: Change the test to assert a narrower failure: replace
pytest.raises(Exception) in test_corrupt_bytes_raises with a specific exception
type thrown by GetVideoLastFrame.execute for invalid input (e.g.,
pytest.raises(ValueError)) and optionally add a match argument to assert the
error message contains a distinguishing substring like "corrupt" or "decode";
locate this in the test function test_corrupt_bytes_raises which constructs the
bad input via InputImpl.VideoFromFile(io.BytesIO(...)) and calls
GetVideoLastFrame.execute(video).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ece8b7bb-bfd0-46b1-85ce-ef74d8c60228
📒 Files selected for processing (2)
comfy_extras/nodes_video.pytests-unit/comfy_extras_test/nodes_video_test.py
|
As discussed, this can be managed with a couple of nodes packaged as blueprints. We will add it to the next blueprints updates: #13611 Example:
Blueprint:
|


No description provided.