Skip to content

v5.2.0

Latest

Choose a tag to compare

@steelbrain steelbrain released this 20 May 14:01
8c9813d

New Features

  • Client fallback to local ffmpeg on dial failure (#16, #18) — when the remote server is unreachable, the client can transparently run the host's local ffmpeg/ffprobe so transcoding (Jellyfin etc.) keeps
    working. Opt-in via fallbackToLocal in client config or FFMPEG_OVER_IP_CLIENT_FALLBACK_TO_LOCAL=true.
    • Triggers only on dial failure; mid-session errors stay fatal.
    • Local binary resolved via $PATH, with self-exclusion (via os.Executable + EvalSymlinks) to prevent recursion when the client is installed as ffmpeg on PATH.
    • Optional fallbackRewrites reuses server rewrite logic (now shared via internal/rewrite).
    • FFMPEG_OVER_IP_* env vars stripped from the child so the auth secret can't leak via /proc/<pid>/environ.
    • All diagnostics go through the configured log sink — never to the stdout/stderr that callers parse.
    • Cross-platform exit-code mapping (128+sig on Unix; raw ExitCode on Windows).
    • Optional client debug flag logs original/rewritten args.

Improvements

  • Argv-aware rewrites (#21) — the rewrite engine now matches whole argv elements (with multi-token support) instead of running strings.ReplaceAll per element.
    • find and replace are split on whitespace; a rewrite matches when find's tokens equal a consecutive run of whole argv elements, and the run is replaced by replace's tokens.
    • Enables GPU-vendor translation like ["-hwaccel qsv", "-hwaccel cuda -hwaccel_output_format cuda"].
    • Empty/whitespace-only replace removes the matched run.
    • Rewrites apply in declared order; same rewrite fires for every matching run.
    • Breaking change: configs that relied on substring rewriting inside args (e.g. ["nvenc", "qsv"] to rewrite h264_nvench264_qsv) must be updated to whole-element form (["h264_nvenc", "h264_qsv"]).
    • docs/configuration.md and the JSONC templates updated with new examples (2→2 swap, 2→4 expansion, 1→0 / 2→0 deletion); client template now also documents fallbackToLocal and fallbackRewrites.

Bug Fixes

  • Allow 32-bit PowerShell on 64-bit Windows in install scripts (#15) — switched the arch check from [RuntimeInformation]::OSArchitecture (which returns X86 under WoW64 due to a .NET Framework quirk) to
    [Environment]::Is64BitOperatingSystem, so the default Windows PowerShell shortcut works on 64-bit Windows. Reported in #9.

  • Handle flat and wrapped zip layouts in install scripts — older release zips nest binaries in a top-level wrapper directory; newer manually-uploaded zips are flat. Scripts now detect the wrapper at extract
    time and fall back to the extract root when absent, so both layouts install correctly.

Testing / CI

  • Auto-attach build zips to GitHub Releases on v* tags — release workflow now packages per-platform build outputs into the historical <platform>-ffmpeg-over-ip-<role>.zip naming, generates an aggregated
    SHA256SUMS, and publishes via softprops/action-gh-release. Permissions stay contents: read by default; only the publish job re-grants contents: write.

  • Existing tests pass on Windows (#20) — fixed several pre-existing tests in internal/process, internal/config, internal/filehandler, and cmd/server that depended on Unix-only details (SIGUSR1,
    /bin/echo, POSIX file mode bits, POSIX errno names, HOME env var, deleting an open file). None had run in CI before; the suite is now genuinely cross-platform and runs on windows-latest.

    • internal/process: TestSignalSIGUSR1 moved to a !windows-tagged file; TestMain exits early on Windows.
    • cmd/server: TestHandleConnectionSuccess builds a tiny echo stub via go build instead of relying on /bin/echo.
    • internal/config: tests mirror HOMEUSERPROFILE and TMPDIRTMP/TEMP on Windows; TestLoadConfigUnreadableFile skips on Windows (chmod 0o000 doesn't deny read on NTFS); TestExpandLogVars
      substitutes the canonical os.TempDir() form on Windows.
    • internal/filehandler: TestFstat compares mode against os.Stat rather than a hardcoded 0o644; non-existent-file tests use t.TempDir() to avoid ERROR_BAD_UNIT colliding with POSIX ENOTDIR.
  • Small production changes justified by Windows test fixes:

    • config.SetupLogging now returns a cleanup func that closes the log file. cmd/client/main.go and cmd/server/main.go defer it, closing the file cleanly on shutdown instead of leaking. Required because
      Windows can't delete a file with an open handle.
    • filehandler.mapErrno falls back to errors.Is(err, fs.ErrNotExist / fs.ErrExist / fs.ErrPermission / fs.ErrInvalid) after the POSIX syscall.Errno switch misses, catching Windows error codes like
      ERROR_FILE_NOT_FOUND and ERROR_ALREADY_EXISTS that don't share numeric values with POSIX errnos. Unix behavior preserved (POSIX match runs first).
  • Added windows-latest CI job for OS-specific paths; expanded the Go test job to include cmd/; added an integration script covering the fallback path end-to-end (rewrite + env scrub + exit propagation,
    ffprobe routing, fallback-off regression, no-binary-on-PATH, self-skip, debug=true).


Full Changelog: v5.1.0...v5.2.0