feat(parse): implement video key frame extraction with metadata#943
Open
mvanhorn wants to merge 1 commit intovolcengine:mainfrom
Open
feat(parse): implement video key frame extraction with metadata#943mvanhorn wants to merge 1 commit intovolcengine:mainfrom
mvanhorn wants to merge 1 commit intovolcengine:mainfrom
Conversation
Replace the _generate_video_description() stub with a working OpenCV integration. Adds _extract_metadata() for duration/resolution/fps and _extract_keyframes() for periodic frame capture at configurable intervals. Wires real metadata into parse() so ResourceNode gets actual video dimensions instead of zeros. Degrades gracefully when opencv-python-headless is not installed. Added as optional dependency: pip install openviking[video] Relates to volcengine#372
|
Failed to generate code suggestions for PR |
Contributor
Author
|
Same build CI issue as #942 - see #942 (comment). The |
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.
Description
Implement video processing in
VideoParserusing opencv-python-headless. Replaces three stubs:_extract_metadata(): extracts duration, resolution, fps, frame count from video files viacv2.VideoCapture_extract_keyframes(): captures frames at configurable intervals (default 10s), returns (timestamp, jpeg_bytes) tuples_generate_video_description(): produces structured markdown with metadata and keyframe timelineAlso wires real metadata into
parse()soResourceNodegets actual video dimensions instead of placeholder zeros.Related Issue
Relates to #372
Type of Change
Changes Made
_extract_metadata()invideo.pyusing cv2 for duration/resolution/fps_extract_keyframes()invideo.pyfor periodic frame capture with max_frames cap (30)_generate_video_description()stub with metadata + keyframe timeline output_extract_metadata()intoparse()to populate real metadata values[video]optional dependency group inpyproject.toml(pip install openviking[video])tests/parse/test_video_keyframes.pyTesting
ruff formatandruff checkpassDesign decisions
parse()returned zeros for duration/width/height/fps. Now returns real values when cv2 is available, zeros otherwise (backward compatible).This is the second part of the multimodal parsing trilogy: audio ASR (#805), image OCR (#942), and video processing.
This contribution was developed with AI assistance (Claude Code).