[output] Add optional TwelveLabs scene labelling#555
Open
mohit-twelvelabs wants to merge 1 commit into
Open
Conversation
Adds scenedetect.output.label_scenes, an opt-in helper that attaches a short natural-language description to each detected scene using the TwelveLabs Pegasus video-understanding model. Pixel-based detectors locate the cuts; this forwards each scene's start/end timecode to Pegasus so the description covers only that portion of the video. The integration is gated behind the optional 'twelvelabs' extra and is never invoked during normal detection.
|
that is exciting! the pip install isn't working for me though. user error? |
Author
|
Not user error — that's pip install 'scenedetect[twelvelabs]'One caveat: since this is still an open PR (not yet on PyPI), pip won't find the pip install 'scenedetect[twelvelabs] @ git+https://github.com/mohit-twelvelabs/PySceneDetect.git@feat/twelvelabs-integration'or clone the branch and — Mohit (@mohit-twelvelabs, TwelveLabs) |
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.
Hi! I'm Mohit, I work at TwelveLabs (@mohit-twelvelabs).
What this adds
An opt-in
scenedetect.output.label_sceneshelper that attaches a short natural-language description to each detected scene using the TwelveLabs Pegasus video-understanding model.PySceneDetect's detectors find where the cuts are (pixel/histogram/hash based); this complements that by answering what is in each scene. Each detected scene's start/end timecode is forwarded to Pegasus via its
start_time/end_timeparameters, so each description covers only that portion of the video and the labels line up 1:1 with the scene list:Why it helps
A common ask after shot detection is a quick semantic summary per scene (for editing, search, dataset labelling, highlight reels). This wires that in without the user having to build their own pipeline, while keeping PySceneDetect's pixel-based detection as the source of truth for cut boundaries.
Opt-in / non-breaking
pip install scenedetect[twelvelabs]. Thetwelvelabspackage is not a hard dependency; if it's missing,label_scenesraises a friendlyImportErrorwith install instructions.scenedetect.outputhelpers, following the existing re-export convention.How it was tested
tests/test_labels.py) using a fake client assert the per-scene timecode wiring and source-argument validation; these run in CI without a key.TWELVELABS_API_KEY(and aTWELVELABS_TEST_VIDEO_URL) are set.analyzerequest wiring (modelpegasus1.5, video source, prompt, per-scenestart_time/end_time,max_tokens) passes all server-side parameter validation. Full per-scene generation against a hosted sample is pending a clean public sample URL.ruff checkandruff format --checkpass on all changed files;pytest tests/test_labels.pypasses (2 passed, 1 skipped).You can grab a free API key at https://twelvelabs.io — there's a generous free tier.