Skip to content

Conversation

@horatiualmasan
Copy link
Contributor

@horatiualmasan horatiualmasan commented Dec 23, 2025

What has changed and why?

Updated the video frame streaming function:

  • Added a compressed query parameter to request JPEG (quality 60) instead of PNG
  • Moved CPU-intensive video processing (decoding, encoding) to a thread pool executor
  • Implemented thread-local cache for cv2.VideoCapture objects

How has it been tested?

Tested locally with local and cloud videos.
You can use the following cloud videos to test:
"gs://lightly-edge-datasets/video_eval/Video6.mp4" - longer video with higher res frames
"gs://worker-test-datasets/50k_videos/protex_1/videos_100" - shorter videos

Example with cloud videos:
New implementation
https://github.com/user-attachments/assets/6cf2f95d-74fc-4602-9931-8aaa08f82037

Old implementation
https://github.com/user-attachments/assets/f755adaf-6b83-49da-903b-ac356b905d7d

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

@horatiualmasan horatiualmasan marked this pull request as ready for review December 23, 2025 14:55
@horatiualmasan
Copy link
Contributor Author

/review

self.close()


def _get_cached_capture(video_path: str) -> cv2.VideoCapture:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need tests for this

Copy link
Contributor

@ikondrat ikondrat left a comment

Choose a reason for hiding this comment

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

lgtm but it is better to cover changes with tests

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.

3 participants