feat: add audio/video file type support for structured extraction#3
Merged
saksham-nexla merged 1 commit intomainfrom Mar 23, 2026
Merged
Conversation
Add audio extensions (mp3, wav, m4a, ogg, flac, aac, wma) and video extensions (mp4, webm, mov, avi, mkv, wmv) support: - Add _AUDIO_EXTS and _VIDEO_EXTS sets to mimetypes_map.py - Add is_audio() and is_video() helper functions - Add audio/video handling in _prepare_single_file() as BinaryContent with native audio/*/video/* MIME types - Update README.md to document audio/video support and remove from 'not supported' section Co-Authored-By: mihir.pamnani <mihir.pamnani@nexla.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
abhijit914
approved these changes
Mar 23, 2026
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.
Summary
Adds audio and video file handling to nextract's extraction pipeline. Audio (
.mp3,.wav,.m4a,.ogg,.flac,.aac,.wma) and video (.mp4,.webm,.mov,.avi,.mkv,.wmv) files are now recognized and attached asBinaryContentwith their native MIME types, following the same pattern as image file handling.Changes:
mimetypes_map.py: New_AUDIO_EXTS/_VIDEO_EXTSsets andis_audio()/is_video()helpers (mirrors existing_IMAGE_EXTS/is_image())files.py: Audio/video branches in_prepare_single_file(), placed between PDF and office-binary handlingREADME.md: Replaces "Not supported: Audio/Video" with documented audio/video support in both the scope and file-type-handling sectionsThis is Phase 2 of the audio/video structured extraction plan. Companion PR in veda-ai adds these extensions to
SUPPORTED_FILE_TYPES(Phase 1).Review & Testing Checklist for Human
is_audio()/is_video()functions and the audio/video branches in_prepare_single_file()are untested. Consider whether tests should be required before merge..m4a/.wma— these rely onmimetypes.guess_type()from stdlib (no custom entries in_CUSTOM). Verifyguess_mime(Path("test.m4a"))returnsaudio/mp4or similar on your target environment, notapplication/octet-stream.path.read_bytes()loads the entire file into memory. Acceptable for the existing image pattern, but video files can be 100MB+. Verify this aligns with expected file size limits upstream..mp3and.mp4file, call_prepare_single_file(Path("test.mp3"))and verify the returnedPreparedParthasbinaryset with the correctmedia_type. Also verify an end-to-endextract()call with a model that supports audio/video input (e.g. Gemini) actually produces structured output.Notes
SUPPORTED_FILE_TYPESin the Phase 1 PR.Link to Devin session: https://app.devin.ai/sessions/66c886f2998044ce8279af8a4c5d8a51
Requested by: @mihir-nexla