Opened 3 years ago

Closed 3 years ago

#9091 closed defect (needs_more_info)

WEBVTT doesn't support magic-less metadata headers

Reported by: mid-kid Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

FFmpeg version: 4.3.1

WEBVTT is a weird format, but I just encountered a file that is written like:
`
WEBVTT

Region: id=r1 width=100% lines=3 regionanchor=0%,96% viewportanchor=0%,100% scroll=none
Region: id=r2 width=100% lines=1 regionanchor=0%,96% viewportanchor=0%,100% scroll=none
....

1
00:00:01.240 --> 00:00:13.200 region:r1 line:88% align:left
<c.white.background-black>#</c>
`

FFmpeg interprets the block with the "Region:" metadata as a cue, due to being separated with two newlines from the "WEBVTT" magic, and the block not starting with "NOTE" (libavformat/webvttdec.c). This causes the subtitles not to show up in the MPV video player at all. Removing this extra newline between the magic and the region metadata solves the issue, but let's assume I can't modify these subtitle files.

According to the spec[1], a webvtt file starts the magic, followed by optionally a tab or space, any additional characters, and *one or more line terminators*. This can be followed by zero or more metadata headers, which consist of a name, a colon, and a value.

Unless I missed something, I believe these files are according to spec, and ffmpeg should be fixed to support this.

[1]: https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/region.html#extension-of-the-webvtt-file-body-syntax

Change History (2)

comment:1 by Carl Eugen Hoyos, 3 years ago

Please attach a sample file.

comment:2 by Carl Eugen Hoyos, 3 years ago

Resolution: needs_more_info
Status: newclosed
Note: See TracTickets for help on using tickets.