SRGSSR / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
2 stars 1 forks source link

fix: hls subtitle frame never duplicated #8

Closed SebastienChauvin closed 1 year ago

SebastienChauvin commented 1 year ago

Chromecast shakaplayer does not de-duplicate cues in HLS.

This fixes it by only outputing cues that start during the segment.

From my understanding (and some testing), the subtitles will not disappear early on segment change in normal playback if they are not duplicated in all segments. The only ill effect I can think of is that the cue will not appear on seek in some cases. But this is not a common use case, so a much less visible impact than duplicated segments.

For example with 8s segments, segment 2 will be from 00:08:00 to 00:16:00

Before:

s-1-f7.vtt

WEBVTT

1
00:00:00.120 --> 00:00:4.120
Dies ist ein Text auf Türkisch

2
00:00:07.320 --> 00:00:09.920
* Roter Hintergrund *

s-2-f7.vtt

WEBVTT

2
00:00:07.320 --> 00:00:09.920
* Roter Hintergrund *

3
00:00:10.120 --> 00:00:12.120
Dies ist ein Text auf Türkisch

After:

s-1-f7.vtt

WEBVTT

1
00:00:00.120 --> 00:00:4.120
Dies ist ein Text auf Türkisch

2
00:00:07.320 --> 00:00:09.920
* Roter Hintergrund *

s-2-f7.vtt

WEBVTT

3
00:00:10.120 --> 00:00:12.120
Dies ist ein Text auf Türkisch