Page 1 of 1

Problem with multiple subtitle tracks for one language (mkv)

Posted: Sun Nov 17, 2013 9:40 am
by blami
Hi,
I think I found a really weird thing with subtitle tracks/priority using mencoder as engine. I got some Japanese movies in .mkv which include two audio tracks (-aid=1 2.0 ENG/ -aid=0 2.0 JPN) and two subtitle tracks - both English, one for conversation subtitles (sid=0), other for song lyrics (sid=1). I'm not able to make UMS 3.0 play file properly, I have following settings:

Code: Select all

audio_languages = jpn,eng,cze,und
subtitles_languages = eng,cze,und
audio_subtitles_languages = jpn,eng;eng,cze;cze,off;*,eng
With this settings UMS selects correct audio track (-aid=1) but never selects correct -sid (it always defaults to =1 which is less important). Is there any way to tell UMS 3.0 which of same language subtitle tracks it should take? I was trying to play with forced tags, but that doesn't work for me. Also I know mplayer/mencoder is not able to show two subtitle tracks at once (afaik) so what I want is make it default to -sid=0 instead of -sid=1. Only way I was able to do this is to breaking audio_subtitles_languages like this (i think it's weird bug that causes it behave correctly for me, can anyone confirm/explain?):

Code: Select all

audio_subtitles_languages = jpn,eng,cze
I have some constraints - I don't want TRANSCODE folder, because my GF who often watches these movies alone is BFU and she's very confused by TRANSCODE folder, so I just want to set good priorities for a few usecases we have (always prefer jpn audio and add eng subtitles, for anything with eng but not jpn,cze audio use eng audio and cze subtitles if avail, cze audio no subtitles.) Second is that I can't touch files to remove/retag tracks, because they're served from r/o location.

My idea is to add some inverse mechanism for forced subtitle tags like:

Code: Select all

ignore_subtitle_tags = sing,lyric,song
and skip them during subtitle track selection (in my case there's always tag and I believe it's impossible to do good heuristics which track to select from two of same language without tag). If this makes sense and there's no better way to do this already, I can create and submit patch.

Re: Problem with multiple subtitle tracks for one language (

Posted: Sun Nov 17, 2013 11:20 am
by ExSport
Post here mediainfo output so we can see more info about subtitle and audio tracks.
Btw. your settings doesn't correspond with behavior you described as correct.
You said eng audio is played with eng subs what is correct? No it is not correct upon your preference settings. Jpn audio with eng subs should be correct when respecting preference settings. Forced subs works only when subs are tagged in correct way and are played only in case native audio is played. If you will set cs as your native language (cs,off as first priority), cs subs will be loaded also in case you set subs as off. You don't want to see partial subs for foreign language but for your mother language only;-)

Re: Problem with multiple subtitle tracks for one language (

Posted: Sun Nov 17, 2013 12:38 pm
by blami
Post here mediainfo output so we can see more info about subtitle and audio tracks.

Code: Select all

General
Unique ID                                : 192881078148609789335105076544485458610 (0x911B8B5E88777258BE5AB1CA4C4402B2)
Complete name                            : test.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 424 MiB
Duration                                 : 24mn 45s
Overall bit rate                         : 2 397 Kbps
Encoded date                             : UTC 2011-04-07 22:04:01
Writing application                      : mkvmerge v4.0.0 ('The Stars were mine') built on Jun  6 2010 16:18:42
Writing library                          : libebml v1.0.0 + libmatroska v1.0.0
Attachment                               : Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 24mn 45s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 98 r1649 20cbe10
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #1
ID                                       : 3
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : A_AAC
Duration                                 : 24mn 45s
Channel count                            : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Title                                    : Japanese 2.0
Language                                 : Japanese
Default                                  : No
Forced                                   : No

Audio #2
ID                                       : 4
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : A_AAC
Duration                                 : 24mn 45s
Channel count                            : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Title                                    : English 2.0
Language                                 : English
Default                                  : Yes
Forced                                   : No

Text #1
ID                                       : 2
Format                                   : ASS
Codec ID                                 : S_TEXT/ASS
Codec ID/Info                            : Advanced Sub Station Alpha
Compression mode                         : Lossless
Title                                    : English
Language                                 : English
Default                                  : No
Forced                                   : No

Text #2
ID                                       : 5
Format                                   : ASS
Codec ID                                 : S_TEXT/ASS
Codec ID/Info                            : Advanced Sub Station Alpha
Compression mode                         : Lossless
Title                                    : English Songs & Signs
Language                                 : English
Default                                  : Yes
Forced                                   : No

Menu
00:00:00.000                             : :Prologue
00:02:31.983                             : :Opening
00:04:01.658                             : :Part A
00:10:48.190                             : :Part B
00:23:38.711                             : :Ending
Btw. your settings doesn't correspond with behavior you described as correct.
You said eng audio is played with eng subs what is correct? No it is not correct upon your preference settings. Jpn audio with eng subs should be correct when respecting preference settings. Forced subs works only when subs are tagged in correct way and are played only in case native audio is played. If you will set cs as your native language (cs,off as first priority), cs subs will be loaded also in case you set subs as off. You don't want to see partial subs for foreign language but for your mother language only;-)
I must admit I really don't understand the settings well and just trying to toggle here and there in order to make it work for me. So audio_subtitles_priority + audio_languages is enough? What are the correct settings if I want achieve following scheme:
  • - file has jp audio - then play jp audio and show en subs if available. If en subs not available try any other subs (because some movies have en subs matching UMS's 'und').
    - file has not jp audio and has en audio - then play en audio and show cz subs but not en subs (even if available), possibly fallback to 'und' subs.
    - file has not jp,en audio and has cz audio - then play cz audio without subtitles.
I think I misunderstood 'off' and how forced subs work (and I'm still not sure if I got it from what you're saying). Do I need only to set audio priority and audio_subtitle_priority or even only audio_subtitle_priority in order to achieve this? Like this?

Code: Select all

audio_languages = jpn,eng,cze,und
audio_subtitles_languages = jpn,eng;jpn,und,eng,cze;eng,und
Anyway thanks for response. I'm lost in this audio+subs lottery logic and also very thankful for any information that will help me to understand it :)
Kind regards,

Re: Problem with multiple subtitle tracks for one language (

Posted: Sun Nov 17, 2013 9:18 pm
by ExSport
Your lang codes are ok as you can see here:
http://www.loc.gov/standards/iso639-2/php/code_list.php
Here is quite old description, many things changed but I think for understanding audio/sub preference it is sufficient:
https://code.google.com/p/pms-exsport/wiki/FAQ
In your case you should set (audio/sub part is the best way how to set the best aud/sub logic by its combination):
Audio priority: jpn,eng,cze,und
Sub priority: eng,cze,und
Audio/sub priority: jpn,eng;jpn,und;jpn,cze;eng,cze;eng,und;cze,off;*,cze;*,off
Forced lang: cze
Forced tags = forced, song, sign
Above will set your native lang as cze. When native language is played, you don't need full subs. But if UMS will detect forced subs, you want them to be played only with your native audio also is case preference says to disable them (cze,off). Ums should somehow detect forced subs. For this purpose it is using subtitle title string read from file or external subs. Which words describe forced subs you should set in forced tags settings.
Back to audio/sub combination. In an example Ums will try to load jpn audio with eng subs. If no eng subs present it tries to load und and later cze subs. If not found it tries to load eng audio with cze subs. Not present? Ok, it tries to load untagged=UNDetermined subs. Not found? Ok it tries to load cze audio with disabled subs=off settings. Forced settings can force to load partial subs also for this settings.
Last two are *,cze and *,off. So if nothing from previous settings fits, Ums will try to play any other audio with cze subs. No cze subs found? Ok, definitely disable subs (*,off)
It works for me so it should also for you when correctly set.
But it seems your settings doesn't correspond with final behavior. For this case we will need debug.log in trace mode.