Skip to content

feat(diagnostics): bridge FFmpeg av_log into EngineLog .ffmpeg category - #17

Merged
superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
Delarkz:feat-ffmpeg-log-bridge
May 25, 2026
Merged

superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
Delarkz:feat-ffmpeg-log-bridge

Conversation

@Delarkz

@Delarkz Delarkz commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New FFmpegLogBridge installs av_log_set_callback and forwards every line through EngineLog.emit under a new .ffmpeg category, formatted with av_log_format_line2 so FFmpeg's own [mp4 @ ...] / [h264 @ ...] subsystem prefixes survive.
  • New .ffmpeg case on EngineLog.Category keeps muxer / demuxer / decoder chatter filterable in Console.app independently of the engine's own log lines.
  • FFmpegLogBridge.install() wired into AetherEngine.init() before any libav* entry point runs, so probe/load diagnostics land in Console.app + any host EngineLog.handler from the first call.

Why

Without the bridge, FFmpeg writes to stderr via its default callback — invisible to App Store builds, in-app overlays, and aetherctl's timestamped stdout. Real diagnostic value (corrupt headers, missing PTS, decoder errors) was being silently dropped.

Behavior

  • Default level: AV_LOG_WARNING — surfaces real problems without the per-segment [mp4 @ ...] track ... chatter AV_LOG_INFO emits during normal fMP4 muxing. Hosts wanting verbose output re-call FFmpegLogBridge.install(level: AV_LOG_VERBOSE).
  • Flags: AV_LOG_PRINT_LEVEL (severity survives into Console) + AV_LOG_SKIP_REPEATED (a decoder spamming the same warning collapses to one line + a Last message repeated N times follow-up).
  • Output buffer: 1024 chars, matches ffmpeg's own default callback. Truncation acceptable for diagnostics; no re-alloc loop on overflow.
  • Idempotent: re-calling install() overwrites the callback with the same function pointer, so the unconditional call in AetherEngine.init() is safe across multiple engine instances.
  • Thread-safe by construction: the callback fires from libav* worker threads, and EngineLog.emit already promises thread-safety (OSLog is, and any host handler is required to be by EngineLog's contract).

Install av_log_set_callback at AetherEngine init time and forward each
line through EngineLog.emit under a new .ffmpeg category, formatted with
av_log_format_line2 so FFmpeg's own [mp4 @ ...] / [h264 @ ...] subsystem
prefixes survive. Default threshold AV_LOG_WARNING with
AV_LOG_PRINT_LEVEL + AV_LOG_SKIP_REPEATED flags. Replaces stderr output
that was invisible to App Store builds, in-app overlays, and aetherctl
stdout.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@superuser404notfound
superuser404notfound merged commit c2ae3ef into superuser404notfound:main May 25, 2026
@superuser404notfound

Copy link
Copy Markdown
Owner

Merged as c2ae3ef, Sodalite's AetherEngine pin bumped in 965abb62. Thanks for this, the missing FFmpeg-internal log surface has been a real diagnostic gap for App Store builds and aetherctl runs alike. The defensive level re-check inside the callback (since av_log_set_callback bypasses the default gate) and the AV_LOG_SKIP_REPEATED flag in particular are the kind of detail that turns a "nice to have" into something we can actually leave on in shipped builds without drowning the log ring.

@Delarkz
Delarkz deleted the feat-ffmpeg-log-bridge branch May 25, 2026 08:16
ijuniorfu pushed a commit to ijuniorfu/AetherEngine that referenced this pull request Oct 11, 2026
…superuser404notfound#731)

First stage of TrueHD Atmos with heights. LibTrueHD (the Rust `truehd`
crate behind a C API, prebuilt like LibDovi) decodes presentation 3 of
a TrueHD stream: bed, up to 15 objects and their OAMD with sample
accurate update timing. The renderer places that into a fixed speaker
bed (5.1.2 to 9.1.6, CoreAudio channel order) with dual-balance
constant-power panning, object size, snap, zone masks and per-update
gain ramps. Nothing is wired into playback yet.

Ported from Silo's fork (Silo-Server#6, superuser404notfound#8, superuser404notfound#17), which
offered it as a reference in superuser404notfound#731. The metadata mapping (speaker roles,
elevation, zone masks, screen anchoring, ISF) gets its own tests here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
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.

2 participants