Skip to content

[python] Support encoding images as video - #10171

Open
YannByron wants to merge 1 commit into
apache:masterfrom
YannByron:codex/add-images-as-video
Open

YannByron wants to merge 1 commit into
apache:masterfrom
YannByron:codex/add-images-as-video

Conversation

@YannByron

Copy link
Copy Markdown
Contributor

Purpose

Allow PyPaimon users to append ordered image bytes or Pillow images to a video-frame field without first creating an MP4 themselves. MultimodalTable.add_images_as_video encodes the images with explicit FPS, codec, pixel format, GOP size, and codec options, then reuses the existing add_video descriptor and blob write path.

The encoder validates non-empty input, equal image dimensions, and a one-to-one match between images and table rows. Encoding completes in a temporary file before a Paimon commit, and partial files are removed on failure. The optional pypaimon[video] extra supplies PyAV and Pillow on Python 3.10 or newer.

Tests

  • Encode PNG bytes into MP4 and decode the resulting frames with PyAV.
  • Reject invalid encoding parameters, mixed dimensions, and image/row count mismatches.
  • Verify video-frame descriptors and stored payloads through the table API.
  • Run the affected multimodal test suites: 110 passed, 5 skipped, 24 subtests passed.
  • Run the Python flake8 configuration and Apache RAT license scan.

Encode ordered image bytes or Pillow images into an MP4, then reuse the
existing video-frame descriptor write path. Require explicit encoding
parameters and validate frame counts and dimensions before committing data.

Co-Authored-By: Codex <noreply@anthropic.com>
AI-Model: gpt-6
Co-Authored-By: Codex <noreply@ai-tool.com>
AI-Contributed/Feature: 179/179
AI-Contributed/UT: 191/191

@Akash3121 Akash3121 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.

LGTM

The image-to-video encoder validates inputs, streams image iteration into a temporary MP4, cleans partial output on encoding failures, verifies image/row cardinality before writing, and safely reuses the existing descriptor-backed video path. The optional dependency markers preserve Python 3.6/3.7 compatibility, while CI exercises the new extra on Python 3.10.

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.

2 participants