feat/webm-conversion #4

Merged
nrupard merged 15 commits from feat/webm-conversion into main 2026-04-17 17:36:50 +02:00
Member
No description provided.
Design for the `eyes video convert` subcommand that shells out to
ffmpeg. Supports webm and mp4 output with per-format video codec
allowlists; audio codec is fixed per format in v1.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: nrupard <natrsmith11@gmail.com>
Step-by-step TDD plan implementing the webm/mp4 `video convert`
subcommand per the 2026-04-16 design spec. Nine tasks: module
skeleton + CLI, format table, codec validation, path resolver,
overwrite check, argv builder, ffmpeg wiring, Dockerfile update,
and an opt-in end-to-end integration test.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: nrupard <natrsmith11@gmail.com>
Defines the `eyes video convert` subcommand with its full argument
surface (--format, --codec, --force, positional or flag input/output).
run() is stubbed; subsequent commits fill in the behaviour.

Signed-off-by: nrupard <natrsmith11@gmail.com>
FORMATS is a static table mapping webm/mp4 to default and allowed
video codecs plus a fixed audio codec. lookup_format returns the spec
or None.

Signed-off-by: nrupard <natrsmith11@gmail.com>
resolve_codec returns the format's default when --codec is omitted,
the override when it's in the allowlist, or a clear error listing
allowed codecs otherwise.

Signed-off-by: nrupard <natrsmith11@gmail.com>
Replace the contains-then-find-unwrap pattern with a direct
find().ok_or_else(), dropping the unwrap and the explanatory comment
about returning the static reference (which is now self-evident from
.copied()). Behaviour and error message unchanged.

Signed-off-by: nrupard <natrsmith11@gmail.com>
resolve_path collapses the positional-or-flag pair into a single
PathBuf, with friendly errors for the edge cases clap's ArgGroup
should already reject.

Signed-off-by: nrupard <natrsmith11@gmail.com>
check_input errors if the input file is missing. check_output errors
if the output exists and --force wasn't set.

Signed-off-by: nrupard <natrsmith11@gmail.com>
build_ffmpeg_argv assembles the fixed argument shape passed to
ffmpeg: -hide_banner, -i <input>, -c:v, -c:a, -y, <output>. Paths
are passed as discrete args so spaces are safe.

Signed-off-by: nrupard <natrsmith11@gmail.com>
run() resolves args, validates format/codec, pre-checks input and
output existence, prints a one-line header, then spawns ffmpeg with
stdout/stderr inherited. NotFound spawn error is translated into a
'ffmpeg not found on PATH' message.

Signed-off-by: nrupard <natrsmith11@gmail.com>
Adds ffmpeg to the runtime stage's apk install so containerised
invocations of 'eyes video convert' work without extra setup. The
builder and scratch 'binary' stages are unchanged — the static binary
itself does not link ffmpeg.

Signed-off-by: nrupard <natrsmith11@gmail.com>
Ignored-by-default integration tests that generate a tiny fixture
via ffmpeg's lavfi source, run the compiled eyes binary, and assert
the output file is produced. Run with
  cargo test --test video_convert -- --ignored

Signed-off-by: nrupard <natrsmith11@gmail.com>
Updates the top-level rustdoc in src/main.rs and the Cargo.toml
description so --help and crate metadata reflect the new video
subcommand. Also collapses an unnecessary anyhow::anyhow! qualification
in convert::run to match the file's bare-macro style used elsewhere.

Signed-off-by: nrupard <natrsmith11@gmail.com>
Applies a pass of code-review findings on the video convert
implementation:

- Reject non-regular inputs (directories, sockets) in check_input
  before ffmpeg is invoked, with a specific error message.
- Add check_output_parent so a missing output directory surfaces
  an eyes-owned error instead of an opaque ffmpeg failure.
- Write to an ".eyes-partial.<pid>.<ext>" sidecar and rename on
  success so a crash or SIGINT never leaves a half-written output
  in place of a valid file. The partial path preserves the
  original extension so ffmpeg still detects the container.
- Round-trip argv entries as OsString so non-UTF-8 filenames
  survive on Unix.
- Report signal-kill (SIGKILL/etc.) in the failure message
  instead of degrading to "exit code ?".
- Simplify resolve_codec with a guard-style match.
- Add a non-ignored negative-path integration test (missing
  input) — it exercises eyes's pre-flight before ffmpeg is
  spawned, so it runs on every `cargo test`.
- Note the lavfi fixture choice as a deviation in the design doc.

Cargo.lock picks up the existing 0.2.1 version bump.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
docs: Add README documenting the CLI and ffmpeg runtime dependency
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
89eb67d0c4
The repo had no README. The video-conversion work deferred this as a
separate concern; adding it now so the new `eyes video convert`
subcommand and its ffmpeg runtime dependency are discoverable
alongside the existing image / pdf / noteshrink surfaces.

Covers installation (container image, static binary), per-command
usage with examples, the format/codec matrix for video, development
workflow, and how integration tests that need ffmpeg are gated.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nrupard deleted branch feat/webm-conversion 2026-04-17 17:36:50 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/monkey!4
No description provided.