Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTT cue gets duplicated if it spans segments #573

Closed
joeyparrish opened this issue Mar 20, 2019 · 1 comment
Closed

VTT cue gets duplicated if it spans segments #573

joeyparrish opened this issue Mar 20, 2019 · 1 comment
Labels
status: archived Archived and locked; will not be updated status: working as intended The behavior is intended; this is not a bug

Comments

@joeyparrish
Copy link
Member

System info

Operating System: gLinux
Shaka Packager Version: v2.3.0

Issue and steps to reproduce the problem

When a VTT cue spans a segment boundary, the entire cue is duplicated into two segments. This results in the cue being displayed twice.

Packager Command:

packager \
  --segment_duration 4 \
  --fragment_duration 4 \
  input=v-0144p-0100k-libx264.mp4,stream=video,playlist_name=playlist_v-0144p-0100k-libx264.mp4.m3u8,segment_template=v-0144p-0100k-libx264-s$Number$.mp4,init_segment=v-0144p-0100k-libx264-init.mp4 \
  input=a-eng-0128k-aac-2c.mp4,stream=audio,playlist_name=playlist_a-eng-0128k-aac-2c.mp4.m3u8,lang=eng,segment_template=a-eng-0128k-aac-2c-s$Number$.mp4,init_segment=a-eng-0128k-aac-2c-init.mp4 \
  input=s-en.webvtt,stream=text,playlist_name=playlist_s-en.webvtt.m3u8,lang=en,segment_template=s-en-s$Number$.vtt \
  --hls_master_playlist_output \
  hls.m3u8

The video doesn't seem to matter, but this subtitle is enough to reproduce with any video:

WEBVTT FILE

1
00:00:03.837 --> 00:00:07.299
Captain's log, stardate 41636.9.

2
00:00:07.466 --> 00:00:11.845
As feared, our examination of the
overdue Federation freighter Odin,

Both of these cues span segment boundaries at 4s and 8s. Each will appear twice in the output (the first in both s-en-s1.vtt & s-en-s2.vtt, the second in both s-en-s2.vtt & s-en-s3.vtt).

What is the expected result?
The cue should either appear in only one segment or the time range should be split at segment boundaries.

What happens instead?
The cue and its time range are duplicated across the segments, leading to the cue being displayed twice.

See demo: https://nightly-dot-shaka-player-demo.appspot.com/demo/#asset=https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8;audiolang=de;textlang=en;uilang=en;play

<Please attach the input files or email to shaka-packager-issues@google.com.>
I can provide complete, exact inputs internally if desired, but any cue that spans segments will reproduce with any video.

@kqyang
Copy link
Collaborator

kqyang commented Mar 20, 2019

@joeyparrish This is by design, implemented according to HLS specification:

https://tools.ietf.org/html/rfc8216#section-3.5

Each WebVTT Segment MUST contain all subtitle cues that are intended
to be displayed during the period indicated by the segment EXTINF
duration. The start time offset and end time offset of each cue MUST
indicate the total display time for that cue, even if part of the cue
time range is outside the Segment period.

The specification makes sense to me as I think it is easier to determine if the two cues are the same cue with the same cue start_time and end_time (The player will still need to determine if the two cues are the same cue even if the cue is split at the segment boundary as the users won't want to see the same text disappears and then reappears immediately). The player can also do further optimization to skip the check if the player is playing continuously and the cue has a start time before the current segment's start time.

I thought we had tested the behavior on three common HLS players and made sure it worked as expected: Shaka Player, hls.js, and Safari. It stills works in hls.js and Safari.

It doesn't work in Shaka Player right now. As what you have observed, the cue appears twice in the output. I think it is a bug in Shaka Player.

@kqyang kqyang added status: working as intended The behavior is intended; this is not a bug and removed needs triage labels Mar 20, 2019
shaka-bot pushed a commit to shaka-project/shaka-player that referenced this issue May 8, 2019
There is currently a bug with VTT subtitles in HLS. We plan on fixing
this bug in the future, but for v2.5, we need to switch out the
front-page assets to put our best foot forward.
Thus, this is switching out the HLS version of Angel One to the DASH
version, and the DASH version of the Shaka Player History livestream to
the HLS version. Thus, the asset with a lot of subtitles can be DASH,
while the asset with no subtitles can be HLS.
The other versions of the assets still exist; they are merely now
relegated to the search page.

shaka-project/shaka-packager#573

Change-Id: Icd2518b7caa1fe91d279e279a881c985b4acbc39
@kqyang kqyang closed this as completed Apr 14, 2020
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Jun 13, 2020
@shaka-project shaka-project locked and limited conversation to collaborators Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated status: working as intended The behavior is intended; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants