feat: add video file support (MP4, WebM, MKV)#22
Open
hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
Open
feat: add video file support (MP4, WebM, MKV)#22hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
Conversation
Audio files were previously skipped as unreadable binaries. This adds: - `is_audio()` detection via magic bytes (ID3, RIFF/WAVE, fLaC, OggS, ADTS, M4A ftyp box) with extension fallback - Audio metadata extraction via `ffprobe`: title, artist, album, genre, year, duration, bitrate, codec, sample rate - `build_user_content()` audio mode passes rich metadata as text context so the LLM can suggest a name based on embedded tags - 13 new bats tests covering detection, metadata, and end-to-end naming - README updated with audio formats and ffprobe optional dependency Closes marksverdhei#19
Closes marksverdhei#18 Video files were previously skipped as unreadable binaries. This adds: - `is_video()` detection via magic bytes: EBML header (MKV/WebM), ftyp box with non-audio brand (MP4/MOV/M4V), AVI RIFF marker, MPEG sequence/pack headers. Extension fallback for .avi .mov .flv etc. - Refinement to `is_audio()` M4A detection: now checks the ftyp brand (M4A/M4B/M4P) so MP4 video files are no longer misclassified as audio - Video metadata extraction via `ffprobe`: title, duration, bitrate, video codec, resolution (WxH), frame rate - `build_user_content()` video mode passes metadata as text (no video frames sent to the LLM) - Test assets: sample.mp4 / .webm / .mkv (1-frame 64x64 via ffmpeg) - 9 new bats tests (47 total): detection for mp4/webm/mkv, negative cases (text, audio, m4a), end-to-end naming for all three formats
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
Closes #18
Video files (
.mp4,.webm,.mkv,.mov,.avi, etc.) were previously skipped as binary. This adds full video support using the same approach as the audio PR (#20):is_video()detection via magic bytes: EBML header (MKV/WebM),ftypbox with non-audio brand (MP4/MOV/M4V), AVI RIFF marker, MPEG sequence/pack headers — extension fallback for the restis_audio(): M4A detection now checks theftypbrand bytes (M4A,M4B,M4P) so MP4 video files are no longer misclassified as audioffprobe: title, duration, bitrate, video codec, resolution (WxH), frame rate — passed as text context so the LLM can suggest a name without receiving any video framessample.mp4,sample.webm,sample.mkvgenerated with ffmpeg--dry-runnamingTest plan
bats test.sh # 47 pass (same 3 pre-existing failures from missing `file` command)Manual test with a real video: