After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690911 - matroskademux: ignore disabled streams, signal default subtitle/audio track
matroskademux: ignore disabled streams, signal default subtitle/audio track
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
unspecified
Other Linux
: Normal enhancement
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 623565 751460 760059 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-12-31 03:26 UTC by Frank Dana
Modified: 2018-05-15 09:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
matroskademux: tag disabled streams with FLAG_UNSELECT (1.12 KB, patch)
2018-05-13 23:31 UTC, Tim-Philipp Müller
accepted-commit_now Details | Review

Description Frank Dana 2012-12-31 03:26:58 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.)
Comment 1 Frank Dana 2012-12-31 03:31:33 UTC
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'
Comment 2 Bastien Nocera 2013-01-02 14:01:30 UTC
Totem just tells GStreamer to play the file by default, and doesn't act upon particular subtitles.
Comment 3 Tim-Philipp Müller 2013-03-16 14:59:33 UTC
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.
Comment 4 Tim-Philipp Müller 2013-03-31 14:25:37 UTC
*** Bug 623565 has been marked as a duplicate of this bug. ***
Comment 5 Tim-Philipp Müller 2013-03-31 14:39:59 UTC
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
Comment 6 Tim-Philipp Müller 2015-06-26 13:56:53 UTC
*** Bug 751460 has been marked as a duplicate of this bug. ***
Comment 7 Sebastian Dröge (slomo) 2016-01-04 07:53:06 UTC
*** Bug 760059 has been marked as a duplicate of this bug. ***
Comment 8 Olav Vitters 2016-01-25 09:49:24 UTC
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.
Comment 9 ValdikSS 2016-01-25 10:01:58 UTC
I believe Totem developers should check presence of GST_STREAM_FLAG_SELECT flag in a stream.
Comment 10 Tim-Philipp Müller 2016-01-25 10:10:39 UTC
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).
Comment 11 Olav Vitters 2016-01-25 11:50:14 UTC
Great, thanks for the update!
Comment 12 Edward Hervey 2018-05-12 06:43:34 UTC
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 ?
Comment 13 Frank Dana 2018-05-12 07:04:38 UTC
(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).
Comment 14 Tim-Philipp Müller 2018-05-13 23:31:23 UTC
Created attachment 371983 [details] [review]
matroskademux: tag disabled streams with FLAG_UNSELECT

So they're never picked as default, only by explicit user action.
Comment 15 Tim-Philipp Müller 2018-05-15 09:27:20 UTC
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.)