Skip to content

Conversation

@peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Jan 28, 2025

NOTE: I also deployed a demo just to have feedbacks here: https://developers.canal-plus.com/rx-player/vttc/
For example with a content reproducing the issue: https://developers.canal-plus.com/rx-player/vttc/#!tech_4=DASH!manifest_2w=https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel-wvtt.ism/.mpd


As #1638 reported, we do not support some (or all?) ways of communicating webvtt subtitles in mp4 files.

I initially assumed that webvtt embedded in an mp4 file worked like for TTML (a format we're more used to): the plain subtitle format directly inserted in an mdat box.

Turns out, some contents (like https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel-wvtt.ism/.mpd), actually rely on the metadata from other ISOBMFF boxes (mainly the tfdt and trun boxes) to provide timing information with the mdat reserved for text, identifiers and style information in a new binary format following the ISOBMFF way of doing things (new webvtt-specific boxes).

Weirdly enough, that format does not look at all like the WEBVTT we're used to beside the fact that it uses the same identifier and "settings" concept.

To implement this, I didn't find the spec so I mainly looked around what other players were doing, I hope I did not bring other player bugs or some copyright trap while doing this :D


As now our subtitle parser has to have the context of the whole mp4 file (and not only the mdat's content), and as that parser also has to rely on state (a timescale value) provided by an initialization segment, I had to update the architecture of how subtitles are communicated: they can now be communicated as string or BufferSource types (the latter leading to text encoding detection), and a supplementary timescale argument (defaulting to 1) is now always provided to parsers.

@peaBerberian peaBerberian added work-in-progress This Pull Request or issue is not finished yet Subtitles Relative to subtitles WebVTT Relative to text tracks in the webVTT format labels Jan 28, 2025
@peaBerberian peaBerberian force-pushed the feat/vttc branch 2 times, most recently from 54c9f43 to 2343307 Compare January 28, 2025 17:27
@canalplus canalplus deleted a comment from github-actions bot Jan 28, 2025
@canalplus canalplus deleted a comment from github-actions bot Jan 28, 2025
@peaBerberian peaBerberian force-pushed the feat/vttc branch 7 times, most recently from ec871f8 to c4dadbd Compare January 29, 2025 16:50
@canalplus canalplus deleted a comment from github-actions bot Jan 30, 2025
@canalplus canalplus deleted a comment from github-actions bot Jan 30, 2025
@JohnPaulHarold
Copy link

@peaBerberian tested with the steam in the PR description, and also some internal static DASH streams. Only tested browser, but working well. I can test again when this moves out of work in progress state.

@peaBerberian peaBerberian removed the work-in-progress This Pull Request or issue is not finished yet label Feb 5, 2025
@canalplus canalplus deleted a comment from github-actions bot Feb 5, 2025
@peaBerberian
Copy link
Collaborator Author

peaBerberian commented Feb 5, 2025

@peaBerberian tested with the steam in the PR description, and also some internal static DASH streams. Only tested browser, but working well. I can test again when this moves out of work in progress state.

OK thanks. I just removed the work-in-progress label because I resolved all the remaining points I was unhappy with. It is now in review phase.

To facilitate future tests, I bundled this branch through github's CI which makes it possible to just put in a package.json:

"rx-player": "https://github.com/peaBerberian/rx-player/releases/download/autobuild.6ff637df7d0d2ee8e4851960d62206b73a12d1b7/rx-player.tgz"

@peaBerberian peaBerberian added the Priority: 2 (Medium) This issue or PR has a medium priority. label Feb 26, 2025
@peaBerberian peaBerberian changed the title [WIP] Implement Fragmented WebVTT vtte/vttc Implement Fragmented WebVTT vtte/vttc Apr 15, 2025
@peaBerberian peaBerberian force-pushed the dev branch 2 times, most recently from 00fc806 to b7216b4 Compare April 15, 2025 18:14
As #1638 reported, we do not support some (or all?) ways of
communicating webvtt subtitles in mp4 files.

I initially assumed that webvtt embedded in an mp4 file worked like for
TTML (a format we're more used to): the plain subtitle format directly
inserted in an `mdat` box.

Turns out, some contents (like https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel-wvtt.ism/.mpd),
actually rely on the metadata from other ISOBMFF boxes (mainly the
tfdt and trun boxes) to provide timing information with the `mdat`
reserved for text, identifiers and style information in a new binary
format following the ISOBMFF way of doing things (new webvtt-specific
boxes).

Weirdly enough, that format does not look at all like the WEBVTT we're
used to beside the fact that it uses the same identifier and "settings"
concept.

---

As now our subtitle parser has to have the context of the whole mp4 file
(and not of the mp4 segment), and as that parser also has to rely on
state (a `timescale` value) provided by an initialization segment, I had
to update the architecture of how subtitles are communicated: they can
now be communicated as string or `BufferSource` types (the latter
leading the text encoding detection), and a supplementary `timescale`
argument (defaulting to `1`) is now always provided to parsers.

The vast majority of parsers now do not make use of that `timescale`
value which is kind of ugly though, we may want to find a better
solution.
@github-actions
Copy link

✅ Automated performance checks have passed on commit f5edd2d1c2d651b3102bf5672e58482c7950a9ad with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 20.45ms -> 20.87ms (-0.418ms, z: 0.66338) 28.05ms -> 28.10ms
seeking 16.80ms -> 20.92ms (-4.121ms, z: 2.39186) 11.40ms -> 11.40ms
audio-track-reload 27.11ms -> 27.23ms (-0.114ms, z: 0.36257) 39.60ms -> 39.60ms
cold loading multithread 48.78ms -> 48.01ms (0.764ms, z: 11.02663) 71.60ms -> 70.20ms
seeking multithread 22.63ms -> 14.05ms (8.580ms, z: 0.63931) 10.50ms -> 10.50ms
audio-track-reload multithread 26.85ms -> 26.80ms (0.048ms, z: 0.86552) 39.30ms -> 39.30ms
hot loading multithread 16.26ms -> 16.08ms (0.186ms, z: 3.52803) 23.40ms -> 23.10ms

@github-actions
Copy link

✅ Automated performance checks have passed on commit 8ec740ad2804b6a1a434a189f2b2c34a5a521c61 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.43ms -> 19.48ms (-0.045ms, z: 0.59386) 26.70ms -> 26.70ms
seeking 15.31ms -> 17.42ms (-2.107ms, z: 1.81430) 11.25ms -> 11.25ms
audio-track-reload 26.40ms -> 26.50ms (-0.093ms, z: 0.03507) 38.70ms -> 38.70ms
cold loading multithread 46.96ms -> 46.14ms (0.828ms, z: 11.91238) 68.85ms -> 67.65ms
seeking multithread 21.32ms -> 13.91ms (7.415ms, z: 1.70277) 10.50ms -> 10.50ms
audio-track-reload multithread 26.36ms -> 26.30ms (0.054ms, z: 1.79176) 38.70ms -> 38.55ms
hot loading multithread 15.48ms -> 15.23ms (0.244ms, z: 5.84842) 22.35ms -> 22.05ms

@peaBerberian peaBerberian merged commit 681aa36 into dev Jun 16, 2025
10 checks passed
@peaBerberian peaBerberian added this to the 4.4.0 milestone Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 2 (Medium) This issue or PR has a medium priority. Subtitles Relative to subtitles WebVTT Relative to text tracks in the webVTT format

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants