mpv does not autoload subtitles from folder set by --sub-file-paths when playing from youtube

Created on 8 Jan 2018  路  16Comments  路  Source: mpv-player/mpv

mpv version and platform

mpv 0.27.0+git10~xenial1
LinuxMint 18

Reproduction steps

For example, I have downloaded (by youtube-dl) vtt subtitles (auto-generated) from https://www.youtube.com/watch?v=L_uW0_OvEkk
$ ls /tmp
The Future of Trucking.vtt

Playing video from youtube mpv misses local subtitles
$ mpv --no-terminal --msg-level=all=debug --log-file=/tmp/log --sub-file-paths=/tmp https://www.youtube.com/watch?v=L_uW0_OvEkkv=L_uW0_OvEkk

Expected behavior

mpv should autoload local subtitles playing youtube URL as it does for local mp4
Downloaded mp4 file works fine
$ mpv --no-terminal --msg-level=all=debug --log-file=/tmp/log --sub-file-paths=/tmp "The Future of Trucking.mp4"

mpv recognizes subtitles
[ 0.100][v][find_files] Loading external files in /tmp/
[ 0.100][d][find_files] Potential external file: "The Future of Trucking.vtt" Priority: 3

Actual behavior

playing URL, though mpv sets right video title
[ 1.784][v][cplayer] Set property: file-local-options/force-media-title="The Future of Trucking" -> 1

but does not recognize subtitles name
[ 1.980][v][find_files] Loading external files in /tmp
[ 1.980][d][find_files] Potential external file: "The Future of Trucking.vtt" Priority: 0

Log file

https://ptpb.pw/VTH-

Sample files

https://www.youtube.com/watch?v=L_uW0_OvEkk

Most helpful comment

Or just use --ytdl-raw-options=write-sub=,write-auto-sub=,sub-lang=en and mpv will load them from youtube-dl directly, unless you're modifying them yourself locally.

All 16 comments

Can you test with 0.28 or git?

Nevermind, I can reproduce it with git master.

Right, it doesn't use the media-title when searching for subtitles, it uses the filename. So you'd have to name your subtitles watch?v=l_uw0_ovekk.vtt for them to be autodetected.

So mpv force us to rename "The Future of Trucking" to "watch?v=l_uw0_ovekk"? it is very "meaningful" name. It's ridiculous to have a bunch of such filenames in the folder for youtube videos with auto-generated subtitles - how do you discern them?
Why just not make mpv friendlier and for playing URL just match title?

It's not meaningful for many "web" URLs, you mean. For local files with the same title (quite common) it wouldn't make sense.

a bunch of such filenames in the folder for youtube videos

This is a pretty weird use case. Why not just download the whole video with youtube-dl if you have a folder of stuff for them already?

Or just use --ytdl-raw-options=write-sub=,write-auto-sub=,sub-lang=en and mpv will load them from youtube-dl directly, unless you're modifying them yourself locally.

I just wanted mpv to peek up manually downloaded auto-generated subtitles from --sub-file-paths folder.
I have tried --ytdl-raw-options=write-sub=,write-auto-sub= but in case on youtube there are both static and auto-generated subtitles it seems mpv does not load auto-generated, but only static one.

Can you give an example url?

This video has both static and auto-generated subs, loaded is only static one.
$ mpv --ytdl-raw-options=write-auto-sub=,write-sub=,sub-lang=en https://www.youtube.com/watch?v=MhVw-MHGv4s
It seems that youtube-dl does not fetch both subs
$ youtube-dl --skip-download --write-sub --write-auto-sub -- https://www.youtube.com/watch?v=MhVw-MHGv4s
[youtube] MhVw-MHGv4s: Downloading webpage
[youtube] MhVw-MHGv4s: Downloading video info webpage
[youtube] MhVw-MHGv4s: Extracting video information
[youtube] MhVw-MHGv4s: Looking for automatic captions
[info] Writing video subtitles to: How a Retractable Ballpoint Pen Works-MhVw-MHGv4s.en.vtt
One downloaded, and it's static one.

It seems to be a youtube-dl "issue" where it doesn't give us auto-generated subs if there already exists non-generated for that language.

ok, could you please point me how to make easier playing youtube with auto-generated and other subs available? Is there some scripting method I could tell mpv to pick up auto-generated subs? or at least auto-save subs as ...watch?v=[...] for --sub-file-paths autoloading.

Don't use write-sub= then, only write-auto-sub=.

any one able to load subtitles from youtube. Tried this

mpv  --ytdl-raw-options=write-auto-sub=,sub-lang=en  https://www.youtube.com/watch?v=MhVw-MHGv4s

but nothing seems to work also tried this youtube video also https://www.youtube.com/watch?v=pHxlZ4dTXug

@potholiday Works fine here. With --no-config you also need --slang=en for it to auto-choose that subtitle, but it's there anyway.

@wiiaboo yep worked; Thank you

mpv --no-config --slang=en -ytdl-raw-options=write-auto-sub=,sub-lang=en  https://www.youtube.com/watch?v=pHxlZ4dTXug
Was this page helpful?
0 / 5 - 0 ratings