Gallery metadata describes audio and video - #64
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- probe_media now wraps the decode loop in try/except: a track that opens fine but fails mid-decode (damage past the header) falls back to the header-level fields already gathered (kind, fps, width, height, duration_seconds, sample_rate, channels) instead of 500ing the gallery metadata route, matching read_embedded_metadata's precedent of degrading rather than raising. - Only decode the video stream when a frame count still needs counting; a container with an upfront frame count no longer pays for a video decode it doesn't need. - duration_seconds is now wrapped in float() - older PyAV exposed time_base as a Fraction, which JSON can't serialize. - Unsigned 8-bit PCM is offset-binary (silence = 128): recenter before scaling instead of dividing raw samples by iinfo.max, which reported silence as -6 dBFS. - write_mp4's test fixture now writes a real 220 Hz tone instead of a DC signal, letting the mp4 peak_dbfs tolerance tighten from ±1.5 to ±1.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Items #6 and #6a of the 2026-09-10 MCP field report, executed from
docs/superpowers/plans/2026-09-10-mcp-field-report-followups.md(PR-3 section). Independent of #63.An agent cannot listen. A generated mp3 answered
metadata: nullfromget_gallery_metadata, so every duration, peak and seam check in a session was done by fetching the file and running ffprobe by hand.dw/media_info.pyprobe_media(path): PyAV probe returningkind,duration_seconds,sample_rate,channels,peak_dbfs,mean_dbfs, and for videofps,frame_count,width,height. One decode pass over the streams it needs — video only when the container stores no frame count (mkv) — levels from the decoded waveform,-120 dBFSfloor. A file that opens but fails mid-decode still answers its header fields rather than raising, so a damaged output never 500s the route.GET /api/gallery/{name}/metadatacarries the result as amediablock for audio/video extensions (nullfor images); the path is_output_file's validated return, no new filesystem access.get_gallery_metadatapassesmediathrough with anexthint;docs/MCP.mdrow; theminimax-music3skill states the rule the report had to rediscover: a track landing within 0.2 s of itsaudio_durationceiling was cut off, one well short of it finished.Not in this PR (plan's Deferred): a per-second level envelope, behind an opt-in parameter.
Full suite: 3313 passed, 5 skipped.
black --checkis clean on every file this branch touches; the two pre-existing master failures are fixed in #63.🤖 Generated with Claude Code