Skip to content

feat: add video file support (MP4, WebM, MKV) (re-land of #22)#30

Merged
marksverdhei merged 2 commits into
mainfrom
reland/sorting-hat-22-video
Jun 27, 2026
Merged

feat: add video file support (MP4, WebM, MKV) (re-land of #22)#30
marksverdhei merged 2 commits into
mainfrom
reland/sorting-hat-22-video

Conversation

@marksverdhei

Copy link
Copy Markdown
Owner

Draft re-land of #22 — hai-pilgrim's PR was 3 months stale. The audio commit on PR22's branch already landed separately as #20, and the video commit had a real cherry-pick conflict:

bats.yml workflow that PR22 also wanted to add was already added separately by #29 today, so left main's version alone.

Summary

is_video() detects MKV/WebM (EBML), AVI (RIFF…AVI), MP4/MOV/M4V (ftyp, excluding M4A/M4B/M4P brands), MPEG-1/2 (sequence/pack header), plus extension fallback for 14 video formats. Video files route through the same metadata-only path as audio (ffprobe → tags/duration/codec, no raw bytes to LLM).

3 tiny test fixtures (sample.mp4/.webm/.mkv) + 9 new bats tests (detection + negative cases + e2e naming).

Closes #18.

Test plan

  • bats test.sh71/71 pass locally (was 62 before; this adds 9)
  • CI green
  • your review

is_video() detects MKV/WebM (EBML header), AVI (RIFF...AVI), MP4/MOV/M4V
(ftyp box, excluding M4A/M4B/M4P audio brands), and MPEG-1/2 (sequence/pack
header), with extension fallback for mp4/mkv/avi/mov/webm/m4v/wmv/flv/mpeg/
mpg/3gp/ogv/ts/mts/m2ts.

Routes video files through the same metadata-only path as audio (ffprobe
for tags/duration/codec; no raw bytes sent to the LLM) — collect_metadata
and build_user_content already handle both 'audio' and 'video' modes.

Adds 9 bats tests (mp4/webm/mkv detection + negative cases + e2e naming)
and 3 tiny test fixtures (sample.mp4/.webm/.mkv).

Re-land of #22 (hai-pilgrim's PR is 3 months stale). Cherry-pick conflict
in hat's is_audio() resolved in favour of HEAD's richer version with #26
context; conflict in test.sh export -f resolved by combining both sides
(needs is_image AND is_video).

Closes #18.
@marksverdhei marksverdhei marked this pull request as ready for review June 27, 2026 15:00
@marksverdhei

Copy link
Copy Markdown
Owner Author

Conflict from merging #28 (preview flag) just now — that landed first and touched the same hat / test.sh regions. Holding this until you rebase. Closed the original #22 to clear the queue. Bats CI is green on this branch standalone (5 tests for video detection); the conflict is in the additive overlap with preview.

@marksverdhei marksverdhei merged commit 1c78d3c into main Jun 27, 2026
1 check passed
@marksverdhei marksverdhei deleted the reland/sorting-hat-22-video branch June 27, 2026 15:23
marksverdhei added a commit that referenced this pull request Jun 27, 2026
) (#31)

README claimed 'Video and other binary files are not supported.' but video
support landed today via #30 (closes #18). Also adds the --preview flag
from #28 (closes #6) to the Features and Usage sections.

Changes:
- Features: list video alongside images/audio + new --preview bullet
- Supported Formats table: add Video row (15 extensions, ffprobe metadata
  path identical to audio)
- Remove the contradicting 'not supported' line
- Update 'Image naming requires...' note to 'Audio and video naming require ffprobe'
- Usage: add --preview example
marksverdhei added a commit that referenced this pull request Jun 27, 2026
Adds (newest first, matching existing style):
- #32 stem-less dotfile guard
- #30 video file support
- #28 --preview / -p flag
- #27 is_audio ftyp false-positive fix
- #20 audio file support

Skipped pure-docs (#15, #16, #17, #31), CI infra (#29), and test-only
rebases (#25) — same selection rule the prior entries used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

video support

1 participant