avformat: set stream.type to "subtitle" for subtitle streams#1222
Closed
xevrion wants to merge 1 commit into
Closed
avformat: set stream.type to "subtitle" for subtitle streams#1222xevrion wants to merge 1 commit into
xevrion wants to merge 1 commit into
Conversation
The switch statement handling meta.media.X.stream.type already sets 'video' and 'audio' for their respective stream types, but had no case for AVMEDIA_TYPE_SUBTITLE, leaving the property unset for subtitle streams in files like MKV. Add the missing case so subtitle streams are reported consistently with video and audio streams.
ddennedy
reviewed
Apr 20, 2026
| frame_rate.den = 1001; | ||
| break; | ||
| case AVMEDIA_TYPE_SUBTITLE: | ||
| mlt_properties_set(meta_media, key, "subtitle"); |
Member
There was a problem hiding this comment.
This does not compile. It looks like you (or your AI) meant to change find_default_streams() instead of this function. I will apply your change to it and close this. With it melt -consumer xml video-with-substitles now shows, for example (good):
<property name="meta.media.2.stream.type">subtitle</property>
<property name="meta.media.2.codec.name">mov_text</property>
<property name="meta.media.2.codec.long_name">3GPP Timed Text subtitle</property>
<property name="meta.media.2.codec.bit_rate">41</property>
<property name="meta.attr.2.stream.language.markup">eng</property>
<property name="meta.attr.2.stream.handler_name.markup">SubtitleHandler</property>Before it was missing <property name="meta.media.2.stream.type">subtitle</property>
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.
The switch statement in
producer_avformat.cthat setsmeta.media.X.stream.typealready handlesAVMEDIA_TYPE_VIDEOandAVMEDIA_TYPE_AUDIO, but has no case forAVMEDIA_TYPE_SUBTITLE. This means subtitle streams in MKV files (and other containers) leave thestream.typeproperty completely unset.This patch adds the missing case:
This makes subtitle stream detection consistent with how video and audio streams are already reported, and allows applications using MLT to reliably detect subtitle streams by checking
meta.media.X.stream.type == "subtitle"instead of having to fall back to inspecting codec names.Tested with an MKV file containing an embedded SRT subtitle stream,
meta.media.2.stream.typeis now correctly set to"subtitle".