Skip to content

Bug: compress with an odd maxWidth fails with a libx264 "not divisible by 2" error #239

Closed

Description

@TMHSDigital

Why it matters

maxWidth: 637 is a value an agent might pick, and it fails with a cryptic encoder error and no output. #47 fixed odd dimensions in the other re-encode tools, but compress was missed.

Evidence

  • src/utils/media.ts:505: args.push("-vf", scale='min(${opts.maxWidth},iw)':-2). maxWidth is only validated as a positive integer.
  • Repro: maxWidth: 637 → libx264 "width not divisible by 2 (637x358)".

Suggested approach

Use scale='trunc(min(N,iw)/2)*2':-2 (always even, never upscales), or reject odd values with validateEvenDimension like the other tools.

Done when

A unit test asserts the filter for odd maxWidth, and an ffmpeg-backed test produces a file.

Activity

  1. added
    bug
    good first issue
    priority: low
    effort: small
    on Oct 25, 2026
  2. CG-5228 commented on Oct 25, 2026

    @CG-5228

    Hi! I'd like to fix this issue and submit a PR so compress handles odd maxWidth values cleanly without failing with a libx264 width-not-divisible-by-2 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugeffort: smallgood first issuepriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions