@@ -77,6 +77,12 @@ local ext_map = {
7777 [" opus" ] = " opus" ,
7878}
7979
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+
8086local codec_map = {
8187 -- src pattern = mpv codec
8288 [" vtt" ] = " webvtt" ,
@@ -87,6 +93,10 @@ local codec_map = {
8793 [" mp4a%..*" ] = " aac" ,
8894}
8995
96+ if has_subrandr then
97+ codec_map [" srv3" ] = " textsub/srv3"
98+ end
99+
90100-- Codec name as reported by youtube-dl mapped to mpv internal codec names.
91101-- Fun fact: mpv will not really use the codec, but will still try to initialize
92102-- 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)
924934 local allsubs = true
925935 local proxy = nil
926936 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
927942
928943 local command = {
929944 ytdl .path , " --no-warnings" , " -J" , " --flat-playlist" ,
930- " --sub-format" , " ass/srt/best "
945+ " --sub-format" , wanted_sub_formats
931946 }
932947
933948 -- Checks if video option is "no", change format accordingly,
0 commit comments