davidde / mpv-autosub

Fully automatic subtitle downloading for the MPV media player
https://mpv.io/
MIT License
295 stars 42 forks source link

Autosub fails to find subtitles when playing videos from URL in MPV, but succeeds when playing downloaded files #42

Closed mortyobnoxious closed 6 months ago

mortyobnoxious commented 1 year ago

Most of the time, when I use services like Seedr to paste a video URL and play it in MPV, the autosub script doesn't find subtitles. However, if I download the same video file to my disk and play it, autosub is able to find subtitles.

To illustrate, let's take the example of playing a movie from YouTube by pasting its URL (e.g., https://www.youtube.com/watch?v=DOZQ_9Ga-bE) in MPV. When I do this, autosub fails to find subtitles. However, if I download the video with the same title and play it using MPV, autosub successfully finds subtitles. This is just an example.

image

The issue seems to be that autosub relies on finding a location on disk to save the subtitles. If it can't locate this location, it reports "no subtitles." (I really don't know the real reason btw, just a guess)

I'm wondering if there's a way to incorporate subtitles directly, similar to the code snippet below, when playing a streamed video (URL) in MPV without being have to save subtitles to disk and instead paste it from URL like below.

function suPaste ()
    local clipboard = get_clipboard()
    mp.commandv("sub_add", clipboard)
    mp.osd_message('Pasted subtitle!')
end