feat: add video file support (MP4, WebM, MKV)#22
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
|
Triage note: PR is CONFLICTING — main has moved on (audio support #20, tests rebased as #25), and the source branch There are 4 conflicts in Possible paths:
|
|
Triaged during hivemind sweep. Stale + conflicting — opened 2026-03-28/29, main has moved substantially since:
|
|
Re-landed as draft PR #30. Cherry-pick had real conflicts (the audio commit was already #20, and the is_audio refactor in this branch was an older version than what landed via #27). Resolved in favour of HEAD's richer is_audio + combined both sides on test.sh |
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: