Skip to content

add test that will fail on get_frame(clip.duration) bug#2383

Draft
blooop wants to merge 3 commits intoZulko:masterfrom
blooop:bug/last_clip_frame
Draft

add test that will fail on get_frame(clip.duration) bug#2383
blooop wants to merge 3 commits intoZulko:masterfrom
blooop:bug/last_clip_frame

Conversation

@blooop
Copy link
Copy Markdown

@blooop blooop commented Feb 25, 2025

I was going to make an issue, but it was actually easier to add a test case that would fail on the bug I found.

I found that if I pass the duration of the clip to .get_frame() it does not return the last frame, but rather the first frame. even passing get_frame(clip.duration-1/clip.fps) does not return the last frame. Only get_frame.duration(clip.duration- 2/clip.fps) will return a frame near the end of the video (I have not confirmed if its actually the last frame).

I have confirmed the test fails locally. The errors are not exactly what I was expecting (I.e I expect the assertion to fail because the requesting get_frame(0) and get_frame(duration) return the same value) but instead I get indexing errors.

Maybe the reason for this will be clearer to someone who understands the codebase better, but I hope this test demonstrates the class of error.

  • I have provided code that clearly demonstrates the bug and that only works correctly when applying this fix
  • I have added suitable tests demonstrating a fixed bug or new/changed feature to the test suite in tests/
  • I have properly documented new or changed features in the documentation or in the docstrings
  • I have properly explained unusual or unexpected code in the comments around it

This is the context in which I found and fixed the bug for my usecase:
https://github.com/blooop/bencher/pull/551/files

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