CogentRedTester / mpv-sub-select

An advanced conditional subtitle track selector for mpv player
MIT License
89 stars 8 forks source link

SubSelect seems to hang/crash MPV. #34

Open AziRizvi opened 1 month ago

AziRizvi commented 1 month ago

MPV Version: v0.38.0-743-gad7976c3 Script Version: Git Master Platform: Windows 10 22H2

Both the issues described below go away when I remove the script from the scripts directory.

Video of the first issue: (If I'm playing any video and I close MPV, this is what happens, the MPV window hangs and then I have to kill the process via task manager.)

https://github.com/user-attachments/assets/c9dee0f2-06b8-49f3-84d7-f7fa99393aa4

Video of the second issue: (If I'm playing a video and I use my mpv keybind for playlist-next or playlist-prev the MPV window hangs as before.)

https://github.com/user-attachments/assets/f3030c4d-2084-4a8d-a3c3-92c26121a118

AziRizvi commented 1 month ago

Upon further testing, I can confirm that I can recreate this issue on the latest MPV build by Shinchiro (v0.39.0-26-gc3d9243a)

This issue only seems to be happening when SimpleHistory by @Eisa01 is also in the scripts folder. (https://github.com/Eisa01/mpv-scripts)

I'm not sure which script is exactly the culprit here since standalone, they both work absolutely fine, the issue only seems to happen when they're both in the scripts folder.

bradenhilton commented 1 month ago

I am also experiencing this issue, specifically when using external subs it seems.

I use mpv-sub-select, uosc (with thumbfast) and chapterskip.

To troubleshoot, I purged the scripts directory and added each one back one at a time. I only experience this issue when I add mpv-sub-select, even if it is the only script present.

Configs

`mpv.conf`: ```text profile=high-quality screen=1 fs-screen=1 fullscreen=yes autofit-larger=100%x100% osc=no osd-bar=no resume-playback=no hwdec=auto-safe volume=80 audio-device=auto audio-channels=2 alang=ja,jpn,ko,kor,en,eng sub-font-size=35 sub-back-color=0.03/0.03/0.03/0.75 sub-shadow-offset=5 sub-border-size=0 sub-border-style=background-box sub-bold=no [autoloop] profile-desc=Automatically loop short videos profile-cond=duration <= 60 profile-restore=copy loop-file=inf ``` `input.conf`: ```text WHEEL_UP ignore WHEEL_DOWN ignore Ctrl+p script-binding uosc/toggle-progress Ctrl+f script-binding subtitle_lines/list_subtitles Ctrl+F script-binding subtitle_lines/list_secondary_subtitles ``` `sub_select.conf`: ```text force_enable=no preload=yes select_audio=no force_prediction=no detect_incorrect_predictions=yes observe_audio_switches=no explicit_forced_subs=no config=~~/script-opts ``` `sub-select.json`: ```json [ { "alang": "eng?", "slang": "no" }, { "alang": "*", "blacklist": ["sign", "song"], "slang": ["eng?", "und"] }, { "condition": "sub.default", "inherit": "^" }, { "condition": "sub.forced", "inherit": "^" } ] ```

Trace

Embedded + external subs (hangs): ```console ❯ mpv --msg-level=sub_select='trace' -- ./video.mp4 [sub_select] Loading lua script C:/Users/User/scoop/apps/mpv-git/current/portable_config/scripts/sub-select.lua... [sub_select] loading mp.defaults [sub_select] loading file C:/Users/User/scoop/apps/mpv-git/current/portable_config/scripts/sub-select.lua [sub_select] reading options for sub_select [sub_select] Opened config file script-opts/sub_select.conf. [sub_select] select subtitle for {"lang" = "eng", "audio-channels" = 2, "demux-channel-count" = 2, "demux-channels" = "stereo", "demux-samplerate" = 48000, "demux-bitrate" = 116624, "default" = true, "id" = 1, "forced" = false, "src-id" = 2, "type" = "audio", "image" = false, "albumart" = false, "dependent" = false, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 1, "codec" = "opus"} [sub_select] checking pref: {"slang" = "no", "alang" = "eng?"} [sub_select] Checking for valid audio: eng? [sub_select] valid audio preference found: "eng?" [sub_select] checking for valid sub: no [sub_select] checking sub no against track {"id" = 0} [sub_select] valid audio preference found: "eng?" [sub_select] valid subtitle preference found: "no" [sub_select] setting sid to no ● Video --vid=1 --vlang=eng (vp9 3840x2160 29.97 fps) [default] ● Audio --aid=1 --alang=eng (opus 2ch 48000 Hz 117 kbps) [default] ○ Subs --sid=1 --slang=eng (mov_text) [default] ○ Subs --sid=2 --slang=eng (mov_text) ○ Subs --sid=3 'video.srt' (subrip) [external] Using hardware decoding (d3d11va). [sub_select] detected audio change - reselecting subtitles [sub_select] select subtitle for {"lang" = "eng", "audio-channels" = 2, "demux-channel-count" = 2, "demux-channels" = "stereo", "demux-samplerate" = 48000, "demux-bitrate" = 116624, "default" = true, "id" = 1, "forced" = false, "src-id" = 2, "type" = "audio", "image" = false, "albumart" = false, "dependent" = false, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 1, "codec" = "opus"} [sub_select] checking pref: {"slang" = "no", "alang" = "eng?"} [sub_select] Checking for valid audio: eng? [sub_select] valid audio preference found: "eng?" [sub_select] checking for valid sub: no [sub_select] checking sub no against track {"id" = 0} [sub_select] valid audio preference found: "eng?" [sub_select] valid subtitle preference found: "no" [sub_select] setting sid to no AO: [wasapi] 48000Hz stereo 2ch float VO: [gpu] 3840x2160 d3d11[nv12] AV: 00:00:01 / 00:25:34 (0%) A-V: -0.000 ``` Embedded + no external subs (does not hang): ```console ❯ mpv --msg-level=sub_select='trace' -- ./video.mp4 [sub_select] Loading lua script C:/Users/User/scoop/apps/mpv-git/current/portable_config/scripts/sub-select.lua... [sub_select] loading mp.defaults [sub_select] loading file C:/Users/User/scoop/apps/mpv-git/current/portable_config/scripts/sub-select.lua [sub_select] reading options for sub_select [sub_select] Opened config file script-opts/sub_select.conf. [sub_select] select subtitle for {"type" = "audio", "audio-channels" = 2, "id" = 1, "demux-channels" = "stereo", "demux-samplerate" = 48000, "demux-bitrate" = 116624, "forced" = false, "default" = true, "lang" = "eng", "src-id" = 2, "demux-channel-count" = 2, "image" = false, "albumart" = false, "dependent" = false, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 1, "codec" = "opus"} [sub_select] checking pref: {"slang" = "no", "alang" = "eng?"} [sub_select] Checking for valid audio: eng? [sub_select] valid audio preference found: "eng?" [sub_select] checking for valid sub: no [sub_select] checking sub no against track {"id" = 0} [sub_select] valid audio preference found: "eng?" [sub_select] valid subtitle preference found: "no" [sub_select] setting sid to no ● Video --vid=1 --vlang=eng (vp9 3840x2160 29.97 fps) [default] ● Audio --aid=1 --alang=eng (opus 2ch 48000 Hz 117 kbps) [default] ○ Subs --sid=1 --slang=eng (mov_text) [default] ○ Subs --sid=2 --slang=eng (mov_text) Using hardware decoding (d3d11va). [sub_select] detected audio change - reselecting subtitles [sub_select] select subtitle for {"type" = "audio", "audio-channels" = 2, "id" = 1, "demux-channels" = "stereo", "demux-samplerate" = 48000, "demux-bitrate" = 116624, "forced" = false, "default" = true, "lang" = "eng", "src-id" = 2, "demux-channel-count" = 2, "image" = false, "albumart" = false, "dependent" = false, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 1, "codec" = "opus"} [sub_select] checking pref: {"slang" = "no", "alang" = "eng?"} [sub_select] Checking for valid audio: eng? [sub_select] valid audio preference found: "eng?" [sub_select] checking for valid sub: no [sub_select] checking sub no against track {"id" = 0} [sub_select] valid audio preference found: "eng?" [sub_select] valid subtitle preference found: "no" [sub_select] setting sid to no AO: [wasapi] 48000Hz stereo 2ch float VO: [gpu] 3840x2160 d3d11[nv12] Track switched: ● Video --vid=1 --vlang=eng (vp9 [Profile 0] 3840x2160 29.97 fps) [default] ● Audio --aid=1 --alang=eng (opus 2ch 48000 Hz 117 kbps) [default] ● Subs --sid=1 --slang=eng (mov_text [Advanced Sub Station Alpha]) [default] ○ Subs --sid=2 --slang=eng (mov_text) AV: 00:00:03 / 00:25:34 (0%) A-V: 0.000 Exiting... (Quit) [sub_select] Exiting... ```