Example Youtube video with external EN sub loaded via ytdl_hook.lua:
[ C:\Users\garoto\AppData\Roaming\mpv\scripts ]
> mpv --msg-level=all=no,ytdl_hook=trace,twitch_chat=trace --sid=1 --no-config --script=twitch_chat https://www.youtube.com/watch?v=vqduGTChT5U
[ytdl_hook] Loading lua script @ytdl_hook.lua...
[ytdl_hook] loading mp.defaults
[twitch_chat] Loading lua script twitch_chat/main.lua...
[ytdl_hook] loading @ytdl_hook.lua
[ytdl_hook] reading options for ytdl_hook
[ytdl_hook] script-opts/ytdl_hook.conf not found.
[twitch_chat] loading mp.defaults
[twitch_chat] loading file twitch_chat/main.lua
[twitch_chat] reading options for twitch_chat
[twitch_chat] script-opts/twitch_chat.conf not found.
[ytdl_hook] ytdl:// hook
[ytdl_hook] not a ytdl:// url
[ytdl_hook] full hook
[ytdl_hook] No youtube-dl found with path youtube-dl.exe in config directories
[ytdl_hook] Running: youtube-dl --no-warnings -J --flat-playlist --sub-format ass/srt/best --format bestvideo+bestaudio/best --all-subs --no-playlist -- https://www.youtube.com/watch?v=vqduGTChT5U
[ytdl_hook] youtube-dl succeeded!
[ytdl_hook] ytdl parsing took 1.756 seconds
[ytdl_hook] No fragments to join into EDL
[ytdl_hook] No fragments to join into EDL
[ytdl_hook] format selection: youtube-dl (separate)
[ytdl_hook] streamurl: edl://!new_stream;!no_clip;!no_chapters;%980%https://r2---sn-b8u-jo4e.googlevideo.com/videoplayback?expire=1626824626&ei=Ugv3YOWdJ53s1sQPj--AsA4&ip=<redacted>&id=o-ALRabbxDmbkZR8mnyCI8P0sTz0WbXtKzwKWvbttNa4vy&itag=315&aitags=133%2C134%2C135%2C136%2C160%2C242%2C243%2C244%2C247%2C278%2C298%2C299%2C302%2C303%2C308%2C315&source=youtube&requiressl=yes&mh=jb&mm=31%2C29&mn=sn-b8u-jo4e%2Csn-bg07dn6l&ms=au%2Crdu&mv=m&mvi=2&pl=21&initcwndbps=938750&vprv=1&mime=video%2Fwebm&ns=7u_eeaB3Xf99erQbqc9YpAgG&gir=yes&clen=4435454665&dur=1395.366&lmt=1584828776934343&mt=1626802847&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=B3QU3os08eotRdn&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgHAogYb9v4IaN5AffcL2Jbqo9uMI-llztcioIT-OhPMsCIH7GhE5QPZp-MV0Dcs0JnPjOlEJNFcMc7w6aYq5DCvcb&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgd1X7mRzdH11gUD5Ut55IWKLDwB7hFjEdW81Z5W2xjugCIHy6QcrU3i9rU61457A9j--XAr6MHX3izDrdY5GeKxFu;!new_stream;!no_clip;!no_chapters;%882%https://r2---sn-b8u-jo4e.googlevideo.com/videoplayback?expire=1626824626&ei=Ugv3YOWdJ53s1sQPj--AsA4&ip=<redacted>&id=o-ALRabbxDmbkZR8mnyCI8P0sTz0WbXtKzwKWvbttNa4vy&itag=140&source=youtube&requiressl=yes&mh=jb&mm=31%2C29&mn=sn-b8u-jo4e%2Csn-bg07dn6l&ms=au%2Crdu&mv=m&mvi=2&pl=21&initcwndbps=938750&vprv=1&mime=audio%2Fmp4&ns=7u_eeaB3Xf99erQbqc9YpAgG&gir=yes&clen=22584635&dur=1395.426&lmt=1584824607623586&mt=1626802847&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=B3QU3os08eotRdn&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgK0yoBx-_3QUEbVEfPMLG65OH0eXP2B1U3dIshQuUtm0CIQCElNXRHn44VsB-B62djxrttEKQsCTYh6gxeRuum-AwAw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgd1X7mRzdH11gUD5Ut55IWKLDwB7hFjEdW81Z5W2xjugCIHy6QcrU3i9rU61457A9j--XAr6MHX3izDrdY5GeKxFu;!global_tags,ytdl_description=%475%Diving into DOOM Eternal! Taking a look at the improvements over Doom 2016, how it's inspired by the classic games, what kind of demonic nonsense ensues, and all kinds of eternally relevant stuff. RIP AND TEAR folks!
[ytdl_hook]
[ytdl_hook] Review code was provided by the publisher. Not sponsored, no payments exchanged, all opinions are my own.
[ytdl_hook]
[ytdl_hook] ? LGR links:
[ytdl_hook] https://twitter.com/LazyGameReviews
[ytdl_hook] https://facebook.com/LazyGameReviews
[ytdl_hook] https://patreon.com/LazyGameReviews
[ytdl_hook]
[ytdl_hook] #LGR #DoomEternal #Review,upload date=%8%20200317,dislikes=%3%606,likes=%5%25493,views=%6%632221,channel_url=%56%https://www.youtube.com/channel/UCLx053rWZxCiYWsBETgdKrQ,uploader=%3%LGR
[ytdl_hook] adding subtitle [en]
[ytdl_hook] script running time: 1.759 seconds
[twitch_chat]
[twitch_chat] stack traceback:
[twitch_chat] [string "twitch_chat/main.lua"]:158: in function 'timer_callback'
[twitch_chat] [string "twitch_chat/main.lua"]:178: in function 'prop'
[twitch_chat] mp.defaults:406: in function 'handler'
[twitch_chat] mp.defaults:509: in function 'call_event_handlers'
[twitch_chat] mp.defaults:554: in function 'dispatch_events'
[twitch_chat] mp.defaults:502: in function <mp.defaults:501>
[twitch_chat] [C]: at 0x00312840
[twitch_chat] [C]: at 0x00311250
[twitch_chat] Lua error: [string "twitch_chat/main.lua"]:67: attempt to concatenate upvalue 'twitch_comments_url' (a nil value)
[twitch_chat] Exiting...
[ytdl_hook] Exiting...
The crash happens at a different spot when the subtitle is embedded in the media:
> mpv --no-config --script=twitch_chat "G:\Torrents\x264\Cowboy Bebop Remastered 01-26 [Dual Audio] H264\[KB]_Cowboy_Bebop_Remastered_06.DVD_(H264.Dual_AC3)[80AA5E1B].mkv"
(+) Video --vid=1 (*) 'Session #6: Sympathy for the Devil' (h264 704x480 23.976fps)
(+) Audio --aid=1 --alang=jpn (*) '6ch Dolby AC3' (ac3 6ch 48000Hz)
Audio --aid=2 --alang=eng '2ch Dolby AC3' (ac3 2ch 48000Hz)
(+) Subs --sid=1 --slang=eng (*) 'Styled Subs (ASS)' (ass)
[twitch_chat]
[twitch_chat] stack traceback:
[twitch_chat] mp.defaults:406: in function 'handler'
[twitch_chat] mp.defaults:509: in function 'call_event_handlers'
[twitch_chat] mp.defaults:554: in function 'dispatch_events'
[twitch_chat] mp.defaults:502: in function <mp.defaults:501>
[twitch_chat] [C]: at 0x00312840
[twitch_chat] [C]: at 0x00311250
[twitch_chat] Lua error: [string "twitch_chat/main.lua"]:174: attempt to index local 'sub_filename' (a nil value)
AO: [wasapi] 48000Hz 5.1(side) 6ch float
VO: [gpu] 704x480 => 704x528 yuv420p
AV: 00:00:00 / 00:24:39 (0%) A-V: 0.000
Exiting... (Quit)
Example Youtube video with external EN sub loaded via
ytdl_hook.lua
:The crash happens at a different spot when the subtitle is embedded in the media: