Skip to content

fix: register every DLL-carrying ffmpeg directory, not the first PATH match (#279) - #286

Merged
RN0311 merged 3 commits into
mainfrom
fix/279-ffmpeg-dll-scan-all-path
Sep 16, 2026
Merged

RN0311 merged 3 commits into
mainfrom
fix/279-ffmpeg-dll-scan-all-path

Conversation

@RN0311

@RN0311 RN0311 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #279 — the residual case of #254. _register_ffmpeg_dll_directory registered the directory of whichever ffmpeg was first on PATH. The README tells a Windows reader to install two builds (Gyan.FFmpeg for the pipeline adapters, Gyan.FFmpeg.Shared for [pyannote]), and only the second carries the DLLs torchcodec loads — so when winget ordered the static build first, following both README lines as written still ended in Could not find module 'libtorchcodec_core9.dll', an error naming neither ffmpeg nor PATH.

The registration now:

  • scans every distinct ffmpeg directory on PATH (shutil.which per entry, deduplicated case-insensitively),
  • registers the ones actually carrying the av*.dll shared libraries — so the static build shadowing the shared one no longer matters, in either order,
  • when an ffmpeg is found but no directory carries the DLLs, keeps the old register-anyway behaviour and logs a warning that names the directories inspected and the fix (winget install Gyan.FFmpeg.Shared), instead of leaving the user with the bare DLL error later,
  • logs each registered directory at debug level.

The README ffmpeg paragraph now states both builds can coexist in either PATH order.

Testing

  • TestFfmpegDllRegistration extended from 3 to 6 tests, all host-independent (platform pinned, which faked per PATH entry, real temp directories for the DLL check): the issue's exact host state (static first, shared second → shared registered, no warning), static-only (registered + warning naming Gyan.FFmpeg.Shared and the inspected directory), two shared builds (both registered), duplicate/empty PATH entries (registered once), plus the original register/no-ffmpeg cases updated to the scan.
  • tests/unit/test_pyannote_utils.py: 21 passed. Smoke: test_preprocessing.py + test_preprocessing_selector.py: 83 passed.
  • ruff check, ruff format --check, ty check all clean.

Note: test_noop_on_posix is deliberately untouched here — its missing platform pin is #278, fixed separately in #285.

@RN0311
RN0311 requested a review from AndyBoWu as a code owner September 16, 2026 05:52
@github-actions github-actions Bot added track: ops Governance docs, templates, repo operations track: toolkit Core psdn-sonar eval toolkit code and tests track: qa Evaluation correctness and regression testing labels Sep 16, 2026
… match (#279)

_register_ffmpeg_dll_directory took shutil.which's first PATH match, so a
Windows host that installed both README builds — Gyan.FFmpeg (static) for
the pipeline adapters and Gyan.FFmpeg.Shared for [pyannote] — still failed
to decode when winget put the static build first: its directory holds no
DLLs, and the failure surfaced as a bare libtorchcodec DLL-loading error
naming neither ffmpeg nor PATH. Every ffmpeg directory on PATH is now
inspected, the ones carrying the av*.dll shared libraries are registered,
and a host where no ffmpeg directory carries them keeps the old behaviour
plus a warning naming the shared build. README now states both builds may
coexist in either PATH order.
@RN0311
RN0311 force-pushed the fix/279-ffmpeg-dll-scan-all-path branch from 8c41b45 to 16d77bb Compare September 16, 2026 06:28
@RN0311
RN0311 merged commit 428c283 into main Sep 16, 2026
17 checks passed
@RN0311
RN0311 deleted the fix/279-ffmpeg-dll-scan-all-path branch September 16, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

track: ops Governance docs, templates, repo operations track: qa Evaluation correctness and regression testing track: toolkit Core psdn-sonar eval toolkit code and tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] The ffmpeg DLL registration takes the first match on PATH, so a host that installed both builds the README names can still fail to decode

1 participant