mpv icon indicating copy to clipboard operation
mpv copied to clipboard

mpv is not showing embedded subtitles after opening with watch later options

Open infini667 opened this issue 2 years ago • 9 comments

I'm using the last shinchiro build (0.35.0.511) on Windows 11, but this was already happening with an older version I was using (0.34.0.436). I tested with no scripts and no config, except:

watch-later-options=start,vid,aid,sid save-position-on-quit

What is happening: I open the MKV file (with embedded subtitles) for the first time, and no subtitle is selected. Then I select a subtitle (1). I close MPV (to save the watch later options) and then open the file again. Now subtitle 1 is selected, but it doesn't show. If I select the next subtitle (2), it starts showing subtitles, and then I can select subtitle 1 again. It works only after doing that.

infini667 avatar Jul 11 '23 08:07 infini667

Try using --demuxer-mkv-subtitle-preroll=yes and increasing the value of --demuxer-mkv-subtitle-preroll-secs to something like 3.0 and see if that helps.

Traneptora avatar Jul 11 '23 09:07 Traneptora

Hi! I tested this again today with a clean mpv, and it is working normally. For some reason, it wasn't working yesterday even with no scripts/configurations, etc. Both versions I'm using are in portable mode (creating the folder "portable_config").

But I found what is causing this issue: the script below. The script is for playing all audio tracks simultaneously. It has nothing to do with subtitles, but for some reason, it is interfering with showing the embedded subtitles.

mp.register_event('file-loaded', function()
    local count = 0
    for _, track in pairs(mp.get_property_native('track-list')) do
        if track.type == 'audio' then
            count = count + 1
        end
    end

    if count == 4 then
        mp.set_property('lavfi-complex', '[aid1][aid2][aid3][aid4]amix=inputs=4[ao]')
    elseif count == 3 then
        mp.set_property('lavfi-complex', '[aid1][aid2][aid3]amix=inputs=3[ao]')
    elseif count == 2 then
        mp.set_property('lavfi-complex', '[aid1][aid2]amix=inputs=2[ao]')
    end
end)

mp.register_event('end-file', function()
    mp.set_property('lavfi-complex', '')
end)

--to disable
local function disable_audio_selector()
    mp.osd_message('Mixagem de áudio desabilitada.')
    mp.set_property('lavfi-complex', '')
    mp.command("cycle audio")
end

mp.add_key_binding('z', 'audio-selector-normal', disable_audio_selector)

infini667 avatar Jul 11 '23 20:07 infini667

It not caused by watch later. If you check the property track-list. You will found the sid is not selected after changing the lavfi-complex

{"id":1,"type":"sub","src-id":3,"title":"SUP","lang":"chi","image":false,"albumart":false,"default":true,"forced":false,"dependent":false,"visual-impaired":false,"hearing-impaired":false,"external":false,"selected":true,"main-selection":0,"ff-index":2,"codec":"hdmv_pgs_subtitle"},

{"id":1,"type":"sub","src-id":3,"title":"SUP","lang":"chi","image":false,"albumart":false,"default":true,"forced":false,"dependent":false,"visual-impaired":false,"hearing-impaired":false,"external":false,"selected":false,"ff-index":2,"codec":"hdmv_pgs_subtitle"},

hooke007 avatar Jul 12 '23 19:07 hooke007

probably fixed by 9e6c6c08975c03b771adc1d2b524d91a985ed2b9?

sfan5 avatar Jul 18 '23 11:07 sfan5

@sfan5 No. That's unrelated commit.

hooke007 avatar Jul 18 '23 11:07 hooke007

The property sid doesn't change. Users thought it was selected, but it was not actually. You have to check property track-list to found it.

hooke007 avatar Jul 18 '23 11:07 hooke007

I'm also facing it on master. --sid=auto does not show any subtitles anymore; an explicit --sid=1 is needed.

alexmercerind avatar Jul 18 '23 17:07 alexmercerind

Apologies for another random comment. I think this is due to what's highlighted in https://github.com/mpv-player/mpv/pull/12015. Those flags do it for me.

alexmercerind avatar Jul 25 '23 18:07 alexmercerind

Hmm, I don't think it was caused by the recent PR because I can reproduce it with 0.34.0 test.log

You probably meet with the another similar issue.

hooke007 avatar Jul 25 '23 18:07 hooke007