Skip to content

Codec fixes: clearer errors, hardware-aware encoder availability, Linux hw ffmpeg, Intel VideoToolbox#21

Merged
StuartCameronCode merged 4 commits into
mainfrom
fix-encoder-errors-and-ui
Jun 9, 2026
Merged

Codec fixes: clearer errors, hardware-aware encoder availability, Linux hw ffmpeg, Intel VideoToolbox#21
StuartCameronCode merged 4 commits into
mainfrom
fix-encoder-errors-and-ui

Conversation

@StuartCameronCode

Copy link
Copy Markdown
Owner

A set of related codec/encoder fixes from this session.

Error reporting

  • Surface the real ffmpeg error instead of vspipe ... SIGPIPE. When the encoder ffmpeg fails (e.g. an unavailable hardware encoder), vspipe dies with SIGPIPE on the closed pipe; the worker now checks ffmpeg's status first and includes the tail of its stderr, so users see e.g. Unknown encoder 'h264_qsv'. A vspipe SIGPIPE is treated as a benign downstream-closed symptom.

Hardware encoder availability (UI)

  • Disable, don't just warn, encoders that aren't usable.
  • Concurrent functional probe: HardwareEncoderDetector is now a ChangeNotifier that, after the cheap ffmpeg -encoders compiled-in list, runs a throwaway one-frame encode per compiled-in hardware encoder to confirm it actually initializes on this machine. Probes run concurrently; the settings codec list shows a busy spinner per encoder while its probe is in flight, then resolves to selectable or disabled with a reason ("Not available in this build" vs "Not available on this system").
  • Platform-filtered codec list: show only the hardware encoders relevant to each OS — VideoToolbox on macOS; QSV/NVENC/AMF on Windows + Linux.

Linux hardware encoding

  • Switch the Linux ffmpeg to BtbN's hardware-enabled static GPL build (x64: QSV/NVENC/AMF/VAAPI; arm64: NVENC/AMF/V4L2M2M). Still runs software-only where no GPU/driver is present (vendor runtimes are dlopen'd lazily); the previous John Van Sickle build had no hw accel.
  • Per-platform deps versioning: deps-version.json + dependency_manager gain optional per-platform version/releaseTag. Linux bumped to 1.4.0 / deps-v1.4.0 (sha256/size null pending the rebuild); macOS/Windows stay on 1.3.0 and won't re-download.

Intel-Mac VideoToolbox

  • Use -b:v (average bitrate) on Intel, -q:v on Apple Silicon. VideoToolbox's constant-quality mode is Apple-Silicon only; on Intel -q:v makes the encoder fail to open. Fixes a reported H.264/H.265 VideoToolbox failure on Intel Macs.

Notes

  • Worker builds clean; all 49 worker unit tests pass. The VideoToolbox test is arch-aware, so CI verifies -q:v on the macOS-arm64 job and -b:v on the x64 jobs.
  • Before release: build/publish Linux deps at 1.4.0 (build-deps-linux.yml, deps-v1.4.0) and fill linux-x64/linux-arm64 sha256+size in deps-version.json. macOS/Windows need nothing.

🤖 Generated with Claude Code

StuartCameronCode and others added 4 commits June 9, 2026 11:15
When an encoder ffmpeg fails (e.g. a hardware encoder not present in the
bundled ffmpeg), vspipe dies with SIGPIPE writing to the closed pipe, and
the worker reported that symptom ("vspipe exited with signal 13") instead
of the cause. Now:

- pipeline_executor checks ffmpeg's status first and includes the tail of
  its stderr in the error, so the user sees e.g. "Unknown encoder
  'h264_qsv'". A vspipe SIGPIPE is no longer reported when it's just the
  downstream pipe closing (ffmpeg's result is authoritative).
- The settings UI now disables (not just warns on) hardware encoders that
  ffmpeg didn't report as compiled into this build, with a clear "Not
  available in this build" reason — preventing a guaranteed-to-fail encode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…iltered codecs

- download-deps-linux.sh: switch FFmpeg from the John Van Sickle static
  build (software-only) to BtbN's static GPL build, which ships hardware
  encoders (x64: QSV/NVENC/AMF/VAAPI; arm64: NVENC/AMF/V4L2M2M) while still
  running software-only where no GPU/driver is present.

- deps-version.json + dependency_manager: add optional per-platform
  version/releaseTag so Linux deps can bump independently. Bump linux-x64
  and linux-arm64 to 1.4.0 / deps-v1.4.0 (sha256/size null pending the
  rebuild); macOS/Windows stay on the global 1.3.0 and won't re-download.

- settings: show only the hardware encoders relevant to each platform
  (VideoToolbox on macOS; QSV/NVENC/AMF on Windows + Linux), instead of
  listing all of them everywhere.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
HardwareEncoderDetector is now a ChangeNotifier with two stages: the
cheap `ffmpeg -encoders` compiled-in list, then a concurrent functional
probe (a throwaway 1-frame encode) per compiled-in hardware encoder to
see if it actually initializes on this machine (driver + device present).
Probes run concurrently and update state as each resolves.

The settings codec list listens to the detector and shows a spinner next
to each hardware encoder while its probe is in flight, then resolves to
selectable (available) or disabled with a reason — "Not available in this
build" (not compiled in) vs "Not available on this system" (probe failed,
e.g. no GPU/driver). This keeps the UI honest once the hardware-enabled
ffmpeg ships, where every encoder is compiled in regardless of hardware.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
h264_videotoolbox/hevc_videotoolbox support constant-quality (-q:v) only
on Apple Silicon. On Intel Macs ffmpeg rejects it ("qscale not available
for encoder. Use -b:v bitrate instead") and the encode fails. (A user's
custom -b:v workaround was ineffective because -q:v still made the
encoder fail to open.)

Select the quality control by arch (per-slice in the universal binary):
-q:v on aarch64 (Apple Silicon), an average bitrate on x86_64 (Intel),
derived best-effort from output resolution/fps and the quality setting
(HEVC ~60% of H.264). The VideoToolbox test now asserts the right flag
per arch, so CI verifies both the Apple-Silicon and Intel jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@StuartCameronCode StuartCameronCode merged commit d1c7fd4 into main Jun 9, 2026
4 checks passed
@StuartCameronCode StuartCameronCode deleted the fix-encoder-errors-and-ui branch June 9, 2026 04:58
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.

1 participant