Open Nicryc opened 11 months ago
Can you provide a sample? According to the logs everything is working properly.
Here it is.
It contains a video file and the .vtt
subtitle file corresponding.
ffmpeg doesn't support webvtt styling or tags. Open a feature request for ffmpeg.
Remuxing the video file by embedding the same .vtt file works.
Whatever program you used to remux it probably converts the vtt file into srt or ass, or just a regular webvtt without styling or tags.
Hmm, I used mkvtoolnix
to remux it. But after what you said I reopened my remuxed video file in it and it is still detected as webvtt file, also checked in the mpv log, still detected as a webvtt. So I used mkvextract
to extract the subtitle track, there is no difference between the extracted subtitle file and the original .vtt
file (code diff here).
I don't know what mkvtoolnix is doing but you can fix the file by deleting line 3 to line 81 in the sample you provided. ffmpeg isn't smart enough to ignore it
mpv does not support vtt styles. There are a lot of edge cases to deal with to allow parsers of all browsers and players to understand the files, and styling support is very hit or miss. Sections can only be styled with cue classes, despite there being a myriad of ways to target them in the spec. Styles themselves are often limited to only the color and background, despite there being more in the spec. https://www.w3.org/TR/webvtt1/
The most compatible way that I could come up with to do styling on supported systems and have others ignore it, is to make the entire STYLE section part of a NOTE. This has unsupported parsers treat "STYLE" and everything else as just part of the note text, while good parsers will notice the start of a STYLE block. To keep all data within the NOTE, there must be no empty lines.
WEBVTT
NOTE
STYLE
::cue(.signs) {
color: black;
background: white;
}
::cue(.title) {
color: black;
background: white;
}
::cue(.thoughts) {
color: cyan;
}
::cue(.radio) {
color: yellow;
}
::cue(.narration) {
color: magenta;
}
::cue(.narration_off) {
color: magenta;
}
::cue(.flashback) {
color: yellow;
}
::cue(.character_card) {
color: white;
background: blue;
}
1
00:00:00.630 --> 00:00:02.300
<c.narration_off>Perceiving in a flash,</c>
2
00:00:02.630 --> 00:00:03.630
<c.narration_off>Once it starts, it won't stop!</c>
Good luck.
Is there a way to display the subtitles and just ignore the styles? --sub-ass-override=strip
doesn't seem to do the trick.
The most compatible way that I could come up with to do styling on supported systems and have others ignore it, is to make the entire STYLE section part of a NOTE. This has unsupported parsers treat "STYLE" and everything else as just part of the note text, while good parsers will notice the start of a STYLE block. To keep all data within the NOTE, there must be no empty lines.
This workaround worked for me, too. I just replaced all STYLE
with NOTE\nSTYLE
.
Important Information
Reproduction steps
.vtt
formatExpected behavior
External
.vtt
subtitles should be displayed.Actual behavior
External subtitles (in the
.vtt
format only) are not displayed when playing a video.Note:
.srt
work with the same video..vtt
file works..vtt
file using VLC and it works.Log file
I detected no error message in the log file but I put it here anyway:
output.txt