GNOME Bugzilla – Bug 690911
matroskademux: ignore disabled streams, signal default subtitle/audio track
Last modified: 2018-05-15 09:27:20 UTC
The Matroska video container implements a set of optional flags on each track (video, audio, subtitle) contained within the container. Included among them are "enabled" and "default" flags, indicating whether a particular track is to be used, or SHOULD be used, respectively. (These flags can be examined using the mkvinfo tool from mkvtoolnix-gui, and modified with mkvpropedit from mkvtoolnix.) When a file containing subtitles is loaded, totem completely ignores these flags, and always displays the subtitles regardless of how they are set. VLC, in contrast, Does The Right Thing™ by respecting the flags and acting accordingly. Some examples follow, using a 1-minute test file from http://www.auby.no/files/video_tests/ — a mirror link originally provided on forum.xda-developers.com for the testing of Android .mkv playback. The following is the original file, containing an enabled/default subtitle track: http://www.auby.no/files/video_tests/h264_1080p_hp_4.1_10mbps_dts_unstyled_subs_monsters.mkv - Both VLC and Totem will play this file with subtitles displayed by default, as expected. (For VLC, this is at least true in an English locale, which matches the subtitle language. Other locales may cause different behavior.) Now the same video, with subtitles default flag set off (using the command 'mkvpropedit -e track:s1 -s flag-enabled=0 $FILE'): https://dl.dropbox.com/u/1031979/h264_1080p_hp_4.1_10mbps_dts_unstyled_nondefault_subs_monsters.mkv - VLC will play this file without displaying subtitles, though they can be manually selected using Video > Subtitle Track menu. - Totem, however, will still play with subtitles displayed by default. Once again, the same video, but now both the default AND enabled flags have been switched off ('mkvpropedit -e track:s1 -s flag-enabled=0 -s flag-default=0 $FILE'): https://dl.dropbox.com/u/1031979/h264_1080p_hp_4.1_10mbps_dts_unstyled_disabled_subs_monsters.mkv - VLC will treat this file identically to the previous one; the subtitles will not be displayed by default, though they can be manually turned on. - Totem, unfortunately, also treats this file identically to the previous one — subtitles are STILL displayed by default, despite being flagged as not enabled! Given that Matroska can specify proper disposition of embedded subtitles on a per-file basis, it would be helpful for Totem to act accordingly. (I wasn't entirely sure whether this functionality would live with the backend or frontend, so I've filed this it under the general component. Proper categorization appreciated.)
Aack! Correction (and I swear I proofread this)... The first mkvpropedit command, corresponding to the second example file (non-default subtitles) should be: 'mkvpropedit -e track:s1 -s flag-default=0 $FILE'
Totem just tells GStreamer to play the file by default, and doesn't act upon particular subtitles.
I agree about the desired behaviour. There are four parts to implementing this: 1) matroskademux should skip disabled streams 2) demuxers need a way to signal the 'default' audio/subtitle stream See bug #695968. 3) playbin should not show subtitles by default unless a default subtitle stream was signalled. See bug #695968. 4) matroskademux should signal default streams.
*** Bug 623565 has been marked as a duplicate of this bug. ***
commit caa06788c31e5c229e7733757f9d7fd583330bac Author: Tim-Philipp Müller <tim@centricular.net> Date: Sun Mar 31 15:30:19 2013 +0100 event: add SELECT and UNSELECT stream flags for stream-start event So demuxers can signal which audio/video/subtitle streams should be selected by default and which should not be selected automatically. API: GST_STREAM_FLAG_SELECT API: GST_STREAM_FLAG_UNSELECT https://bugzilla.gnome.org/show_bug.cgi?id=695968 https://bugzilla.gnome.org/show_bug.cgi?id=690911
*** Bug 751460 has been marked as a duplicate of this bug. ***
*** Bug 760059 has been marked as a duplicate of this bug. ***
Ping? Any progress on this? I'm running into this quite a lot while using Totem. Makes it quite annoying to use. It would be really nice to have this.
I believe Totem developers should check presence of GST_STREAM_FLAG_SELECT flag in a stream.
Extracting the signalling from the stream is trivial, making playbin use it properly is a bit more involved. It will be easier with decodebin3/playbin3 which will feature a proper stream selection API (see bug #758960) and will hopefully land in master in the next cycle (i.e maybe in the next 1-2 months or so).
Great, thanks for the update!
Definitely still valid. * The default stream selection in decodebin3 properly select the default stream (if there are multiple). * matroska-demux doesn't use GST_STREAM_FLAG_UNSELECT, should it ?
(In reply to Edward Hervey from comment #12) > * matroska-demux doesn't use GST_STREAM_FLAG_UNSELECT, should it ? Based on the documented semantics, it sounds like that could be a good way to handle Disabled streams, ensuring that they remain unselected by default but are still available to be explicitly enabled by the user (which matches VLC's handling of them).
Created attachment 371983 [details] [review] matroskademux: tag disabled streams with FLAG_UNSELECT So they're never picked as default, only by explicit user action.
Pushed signalling in matroskademux: commit adc315978ce0e566df4f71163a2ecdbafe66fc04 Author: Tim-Philipp Müller <tim@centricular.com> Date: Mon May 14 00:29:24 2018 +0100 matroskademux: tag disabled streams with FLAG_UNSELECT So they're never picked as default, only by explicit user action. https://bugzilla.gnome.org/show_bug.cgi?id=690911 Rest will now depend on playbin3/decodebin3 and/or app. (I think there are other bugs about this for playbin/decodebin already.)