Skip to content

Conversation

@warrkan
Copy link
Contributor

@warrkan warrkan commented Feb 2, 2026

Resolves #5280

Summary

How to test

Checklist

  • The PR title and description are clear and descriptive
  • I have manually tested the changes
  • All changes are covered by automated tests
  • All related issues are linked to this PR (if applicable)
  • Documentation has been updated (if applicable)

@github-actions github-actions bot added DEPENDENCY Any changes in any dependencies (new dep or its version) should be produced via Change Request on PM TEST Any changes in tests BUILD Geti Tune Backend Issues related to Geti Tune backend labels Feb 2, 2026
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

📊 Test coverage report

Metric Coverage
Lines 34.7%
Functions 74.1%
Branches 88.3%
Statements 34.7%

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Docker Image Sizes

CPU

Image Size
geti-tune-cpu:pr-5385 2.98G
geti-tune-cpu:sha-f18f26c 2.98G

GPU

Image Size
geti-tune-gpu:pr-5385 10.97G
geti-tune-gpu:sha-f18f26c 10.97G

XPU

Image Size
geti-tune-xpu:pr-5385 9.78G
geti-tune-xpu:sha-f18f26c 9.78G

@github-actions github-actions bot added the Geti Tune UI Issues related to Geti Tune UI label Feb 2, 2026
@warrkan warrkan marked this pull request as ready for review February 3, 2026 13:10
@warrkan warrkan requested review from a team as code owners February 3, 2026 13:10
Copilot AI review requested due to automatic review settings February 3, 2026 13:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds video upload functionality to the application, extending the existing image-only media support to handle video files. The changes enable users to upload videos through the API, store them in the dataset, and generate thumbnails from video frames.

Changes:

  • Extended the Media model to support optional width/height and added video-specific fields (fps, frame_count)
  • Added VideoFormat enum and video upload handling in the API and service layers
  • Implemented video metadata extraction and thumbnail generation using OpenCV
  • Updated tests and database schema to accommodate video media types

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
application/ui/src/shared/annotator/annotator-provider.component.tsx Added null coalescing for optional width/height to prevent undefined values in ROI
application/ui/src/features/annotator/tools/edit-bounding-box/edit-bounding-box.component.tsx Added null coalescing for optional width/height in ROI calculation
application/ui/src/features/annotator/tools/bounding-box-tool/bounding-box-tool.component.tsx Added null coalescing for optional width/height in ROI calculation
application/ui/src/features/annotator/annotator-canvas/annotator-canvas.tsx Added null coalescing for optional width/height in size calculation
application/ui/src/features/annotator/annotations/annotation-shape/annotation-shape.component.tsx Added null coalescing for optional width/height in SVG attributes
application/ui/src/constants/shared-types.ts Added DatasetRevisionItem type export
application/ui/mocks/mock-media.ts Added fps and frame_count fields to mock media object
application/backend/tests/unit/services/test_datumaro_converter.py Updated to use ImageFormat instead of MediaFormat and added fps/frame_count fields
application/backend/tests/unit/services/test_dataset_service.py Added test coverage for annotation validation with missing dimensions
application/backend/tests/unit/services/data_collect/test_data_collector.py Updated to use ImageFormat instead of MediaFormat
application/backend/tests/unit/routers/test_media.py Extended tests to cover both image and video media types
application/backend/tests/unit/routers/test_dataset_revisions.py Updated to use ImageFormat instead of MediaFormat
application/backend/tests/integration/services/test_media_service.py Added comprehensive video upload and thumbnail generation tests
application/backend/pyproject.toml Added opencv-python-headless dependency for video processing
application/backend/app/utils/images.py Added explicit resampling method to image resize operation
application/backend/app/services/video/video_service.py Implements video metadata extraction and frame extraction using OpenCV
application/backend/app/services/video/init.py Exports video service functions
application/backend/app/services/media_service.py Added create_video method and video thumbnail generation logic
application/backend/app/services/datumaro_converter.py Added null checks for width/height before processing samples
application/backend/app/services/dataset_service.py Added validation to ensure media has dimensions before validating annotations
application/backend/app/services/data_collect/data_collector.py Updated to use ImageFormat instead of MediaFormat
application/backend/app/models/media.py Added VideoFormat enum and made width/height optional in Media model
application/backend/app/db/schema.py Updated database schema to support optional width/height and video-specific fields
application/backend/app/api/schemas/media.py Updated API schema to support optional width/height and video fields
application/backend/app/api/routers/media.py Added video upload handling and format parsing logic
application/backend/app/alembic/versions/1127bd7a7649_schema.py Updated migration to make width/height optional and add fps/frame_count columns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


DEFAULT_THUMBNAIL_SIZE = 256

VIDEO_WRITE_CHUNK_SIZE = 1024 * 1024 * 1024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall it be 1MB instead of 1GB?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it 100 Mb 😄

id=str(dataset_item.id),
image=image_path,
image_info=ImageInfo(width=media.width, height=media.height),
image_info=ImageInfo(width=media.width, height=media.height), # pyrefly: ignore[bad-argument-type]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What causes the bad-argument-type error here?

data=file.file,
name=name,
format=format,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add a comment here, explaining that for videos we don't create dataset items on upload, but lazily on individual frames when they get annotated.

"""
Extracts a video metadata

:param video_path: Video binary file path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use google style docstrings (Args instead of :param:)

Comment on lines 432 to 437
def _ensure_ffmpeg():
"""Ensure ffmpeg is available on PATH; skip test if not."""
exe = shutil.which("ffmpeg")
if exe is None:
pytest.skip("ffmpeg not found in PATH; skipping video related tests")
return exe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests shouldn't depend on ffmpeg if the application doesn't. You can use OpenCV to generate a dummy video for testing purposes (fxt_video_data).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BUILD DEPENDENCY Any changes in any dependencies (new dep or its version) should be produced via Change Request on PM Geti Tune Backend Issues related to Geti Tune backend Geti Tune UI Issues related to Geti Tune UI TEST Any changes in tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement video upload endpoints

4 participants