Add disposition-aware audio track matching for audio description flavors#13931
Open
LongingForHome wants to merge 2 commits into
Open
Add disposition-aware audio track matching for audio description flavors#13931LongingForHome wants to merge 2 commits into
LongingForHome wants to merge 2 commits into
Conversation
Parses FFprobe disposition flags from mediaInfo output and uses them to disambiguate same-language audio tracks during flavor matching. - KFFMpegMediaParser: captures active disposition flags (e.g. visual_impaired, default) from FFprobe stream data into audioDisposition on each contentStreams audio entry - KDLAudioMultiStreaming: adds $disposition property to KDLStreamDescriptor; new selectStreamByDisposition() selects the correct stream when multiple tracks share the same language — audio_description flavors (tagged 'audio_description') target visual_impaired/visual_impaired_audio streams; standard flavors skip those tracks and prefer the default stream - KDLFlavor: threads $this->_tags through evaluateTargetAudioMultiStream() and GetSettings() so flavor tags are available at stream selection time Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
selectStreamByDisposition() was short-circuiting on single-stream language groups before checking the requested disposition, allowing an AD flavor to match a non-AD track when it was the only stream for that language. Disposition check now always runs when $this->disposition is set, regardless of stream count. Also adds tests/test_audio_disposition_matching.php — a standalone PHP test covering all 6 matching scenarios against the real sample file stream layout (eng/default, eng/visual_impaired, fra, spa). Run: php tests/test_audio_disposition_matching.php Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
KFFMpegMediaParser— parses FFprobedispositionflags (e.g.visual_impaired,default) from each audio stream into a newaudioDispositionarray property on the per-streamKalturaMediaInfoobject stored incontentStreamsKDLAudioMultiStreaming— adds a$dispositionproperty toKDLStreamDescriptorand a newselectStreamByDisposition()method that disambiguates same-language audio tracks by disposition when multiple tracks share the same language code;GetSettings()now accepts flavor tags and automatically injects the required disposition for flavors taggedaudio_descriptionKDLFlavor— threads$this->_tagsthroughevaluateTargetAudioMultiStream()andGetSettings()so flavor tags are available at stream selection timeProblem
When a source file contains multiple audio tracks with the same language (e.g. a standard
engtrack and an audio descriptionengtrack withvisual_impaireddisposition), the KDL previously always selected the first matching stream regardless of disposition. This caused:audio_description) to transcode the wrong trackBehavior after this change
eng/defaultsource trackeng/default✅audio_descriptiontag) +eng/visual_impairedsource trackeng/visual_impaired✅Test plan
A standalone PHP test script is included that exercises all scenarios against the real sample file stream layout (eng/default, eng/visual_impaired, fra, spa) without requiring a full Kaltura platform:
All 13 assertions pass.
Notes
tagsfield onflavorParams(presence ofaudio_descriptiontag)dispositionproperty onKDLStreamDescriptorcan also be set directly via the new-format multiStream JSON ({"audio":{"streams":[{"lang":"eng","disposition":["visual_impaired"]}]}}) for future use cases🤖 Generated with Claude Code