@@ -77,6 +77,12 @@ local ext_map = {
77
77
[" opus" ] = " opus" ,
78
78
}
79
79
80
+ local fullconfig = mp .get_property_native (" mpv-full-configuration" )
81
+ local has_subrandr = false
82
+ for feature in string.gmatch (fullconfig , " ([^ ]+)" ) do
83
+ has_subrandr = has_subrandr or feature == " subrandr"
84
+ end
85
+
80
86
local codec_map = {
81
87
-- src pattern = mpv codec
82
88
[" vtt" ] = " webvtt" ,
@@ -87,6 +93,10 @@ local codec_map = {
87
93
[" mp4a%..*" ] = " aac" ,
88
94
}
89
95
96
+ if has_subrandr then
97
+ codec_map [" srv3" ] = " textsub/srv3"
98
+ end
99
+
90
100
-- Codec name as reported by youtube-dl mapped to mpv internal codec names.
91
101
-- Fun fact: mpv will not really use the codec, but will still try to initialize
92
102
-- the codec on track selection (just to scrap it), meaning it's only a hint,
@@ -924,10 +934,15 @@ local function run_ytdl_hook(url)
924
934
local allsubs = true
925
935
local proxy = nil
926
936
local use_playlist = false
937
+ local wanted_sub_formats = " ass/srt/best"
938
+
939
+ if has_subrandr then
940
+ wanted_sub_formats = " srv3/" .. wanted_sub_formats
941
+ end
927
942
928
943
local command = {
929
944
ytdl .path , " --no-warnings" , " -J" , " --flat-playlist" ,
930
- " --sub-format" , " ass/srt/best "
945
+ " --sub-format" , wanted_sub_formats
931
946
}
932
947
933
948
-- Checks if video option is "no", change format accordingly,
0 commit comments