Named an audio-bearing source _audiovideo and described its sound - #47
Merged
Merged
Conversation
BEP047 gives a recording that carries sound its own `_audiovideo` suffix where a silent one is `_video`. The copy of the source video carried into `sourcedata/` is the only file a delivery writes that can be either, since everything extracted from it drops audio on the way out, so it now takes that suffix whenever the file has an audio track, and its sidecar carries BEP047's audio keys (`AudioCodec`, `AudioSampleRate`, `AudioChannelCount`, `AudioBitDepth`, `AudioCodecRFC6381`) beside the picture ones. The derivative keeps the plain `_video` name. The track is read off the container with mediabunny rather than inferred from the file's name or type; a file that cannot be opened reads as silent rather than being named on a guess, and each key is omitted rather than guessed when the track does not answer for it. `?test&mock_audio` synthesizes a mock recording with a real Opus track, so the whole path is driven end to end. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VkP8ocV3fTrT1FzVnRR5Eg
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VkP8ocV3fTrT1FzVnRR5Eg
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #47 +/- ##
==========================================
- Coverage 84.98% 83.92% -1.06%
==========================================
Files 41 42 +1
Lines 1845 1910 +65
Branches 472 487 +15
==========================================
+ Hits 1568 1603 +35
- Misses 277 307 +30
🚀 New features to boost your workflow:
|
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.
BEP047 gives a recording that carries sound its own
_audiovideosuffix, where a silent one is_video. The copy of the source video carried intosourcedata/is the only file a delivery writes that can be either, so it now takes that suffix whenever the file has an audio track, and its sidecar carries BEP047's audio keys beside the picture ones:The derivative keeps the plain
_videoname: the frame-exact cut and the stream copy both drop audio already (-an, mediabunny'saudio: { discard: true }), so nothing extracted here ever has sound to describe.How the track is read
New
lib/audioFormat.ts, the counterpart tolib/videoFormat.ts: mediabunny opens the file and reports its primary audio track. Nothing is inferred from the filename or MIME type, and each key is left out rather than guessed when the track does not answer for it — a file that cannot be opened at all reads as silent, since naming a file_audiovideoon a guess is worse than under-describing one.Two translations, mirroring the pixel-format one already in
videoFormat.ts: mediabunny names codecs after the WebCodecs registry, BEP047 asks for FFmpeg's naming, so the PCM family maps across (pcm-s16→pcm_s16le,ulaw→pcm_mulaw, …). That mapping is also whereAudioBitDepthcomes from — for uncompressed audio the codec name is the sample width — and it is omitted for compressed codecs, which state none.Testing
?test&mock_audiosynthesizes the mock recording with a real Opus track, sotests/integration/audio.spec.tsdrives the whole path end to end: a save with sound writessub-unknown_audiovideo.mp4plus a sidecar naming the codec, rate and channel count, and the clip cut out of it is still_videowith no audio keys at all. It is written through mediabunny rather than recorded through MediaRecorder because a page that boots straight into a synthesized recording has no user gesture to start anAudioContextwith, and a recorder waiting on a suspended one writes nothing.Unit tests cover the codec translation, the probe's best-effort behavior, both filename suffixes and the sidecar keys. Full suite green: 586 unit, 72 integration.
Original prompt
For the BEP047 (bids-standard/bids-specification#2231) output, if input source video has an audio track, the suffix should become
_audiovideoand should includethe derivative extraction should strip the audio and so just be
_videoas it currently is🤖 Generated with Claude Code
https://claude.ai/code/session_01VkP8ocV3fTrT1FzVnRR5Eg