Repository navigation
Convert load_video frames to RGB when convert_method is None - #15099
Draft
nettanvirdev wants to merge 1 commit into
Draft
nettanvirdev wants to merge 1 commit into
nettanvirdev wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
load_video()documents that frames are converted to "RGB" whenconvert_method=None, but it returned them unchanged. For GIFs, Pillow decodes the first frame asPand later frames asRGB/RGBA, so the mixed modes madeVideoProcessor.preprocess_video()andAnimateDiffVideoToVideoPipelinefail withValueError: all input arrays must have the same shape.This adds the missing
elsebranch so every frame is converted withimage.convert("RGB"), the same asload_image. A customconvert_methodis still applied as before and skips the conversion.Fixes #15098
Notes:
RGBarrays); I checked a locally written mp4 and the frames are identical to the raw imageio frames.PthenRGBAframes) now come back asRGB, matching whatload_imagereturns for the same frames.load_videoexists, so nothing else needs updating. No docs change needed; the docstring already describes this behavior.Tests
Added
TestLoadVideo::test_gif_frames_are_rgbintests/others/test_utils.py.The one failure is
TestDeprecate::test_deprecate_stacklevel, which also fails on main on Windows (it asserts a/-separated path against a\-separated filename).Also ran
ruff check/ruff format --check(0.9.10),utils/check_copies.py,utils/check_dummies.py,utils/check_doc_toc.pyanddoc-builder style --check_only: all clean.Before submitting
self-reviewskill on the diff?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@sayakpaul @DN6