From 15bc7c21edb3e28e6eba77b5366f6ffa696325fd Mon Sep 17 00:00:00 2001 From: "Babil G. Sarwar" Date: Sat, 27 Nov 2021 15:37:08 +1100 Subject: [PATCH] Handle video streams without duration property This patch should handle real-time video streams where duration property is not set by MPV e.g. RTSP streams from live cameras. --- autosub.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autosub.lua b/autosub.lua index f399f52..429cdf9 100644 --- a/autosub.lua +++ b/autosub.lua @@ -166,7 +166,12 @@ end -- Check if subtitles should be auto-downloaded: function autosub_allowed() - local duration = tonumber(mp.get_property('duration')) + local duration_prop = mp.get_property('duration') + local duration = 0 + if duration_prop ~= nil then + duration = tonumber(duration_prop) + end + local active_format = mp.get_property('file-format') if not bools.auto then