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

Multiperiod MPD with VTT subtitles doesn't add the presentationTimeOffset #1164

Closed
vickyvxr opened this issue Nov 30, 2017 · 9 comments
Closed
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@vickyvxr
Copy link

Have you read the FAQ and checked for duplicate issues:
Yes
What version of Shaka Player are you using:
2.2.7
Can you reproduce the issue with our latest release version:
Yes
Can you reproduce the issue with the latest code from master:
Yes
Are you using the demo app or your own custom app:
Demo app and custom app
If custom app, can you reproduce the issue using our demo app:
Yes
What browser and OS are you using:
Chrome - Windows 10
What are the manifest and license server URIs:
(you can send the URIs to shaka-player-issues@google.com instead, but please use GitHub and the template for the rest)

What did you do?
Create a multiperiod MPD with VTT subtitles with presentationTimeOffsets in segmentTemplates

What did you expect to happen?
The subtitles are displayed in the correct timecode with the presentationTimeOffset added/substracted.

What actually happened?
The subtitles are always displayed in the same timecode. See example below.

We have found an issue with presentationTimeOffsets and VTT subtitles in multiperiod MPDs,
as far as I can understand, presentationOffsets aren't taken in account in subtitles.
(#595) when segmentTimeline are presents, but for us, it is necessary to move the VTT files
timestamps using the presentationTimeOffset of each period.
These are our adaptation sets for subtitle tracks:

I will explain this issue with an example, imagine that we have 3 periods:
A [0-60] -> Subtitle "A" in 30, presentationTimeOffset=0
B [60-120] -> Subtitle "B" in 90, presentationTimeOffset=60
C [120-180] -> Subtitle "C" in 150, presentationTimeOffset=90

In each period we have a subtitle track with the corresponding presentationTimeOffsets.
With the current implementation, in each period the subtitles offset are reset, so in each period,
will always appear the "A" subtitle in seconds, 30,90,150.

If we pass the presentationTimeOffset to the subtitle parser, please check the pull request:

// In multiperiod, the presentationTimeOffset is necessary to move the Vtt
// subtitles to the correct time position
if (time.presentationTimeOffset != 0) {
offset = time.segmentStart - time.presentationTimeOffset;
}

We will see the subtitles in each period, "A" in 30, "B" in 90 and "C" in 150,
and if we move the periods:
B A C
The subtitles will be also moved and visible in each period. "B" in 30, "A" in 90 and "C" in 150.

This is my first contribution in github and I don't have much experience with shaka. Could you please check if this is the best solution?

Please check the pull request.

@TheModMaker
Copy link
Contributor

Can you post a playable URL to some content that reproduces your problem?

@joeyparrish
Copy link
Member

Presentation time offsets are already taken into account via TextEngine. If you would, please send a URL so that we can reproduce the issue, and then we will be better able to understand the problem and review your PR.

If you don't want to post the URL publicly for any reason, you can share with the team privately by emailing the link to shaka-player-issues@google.com.

Thanks!

@vickyvxr
Copy link
Author

vickyvxr commented Dec 1, 2017

Good morning,
You can use these two MPDs generated using your sample media in your shaka player demo APP.
These MPDs have 3 periods of 20 seconds with presentationTimeOffsets in audio/video/subtitle tracks.
If you try these files in the demo with the latest version you can see that the subtitles are reset in each period, using the PR version the subtitles are maintained and synchronized with the audio track in all the periods.

Thank you very much for your support :)

@joeyparrish
Copy link
Member

Sorry for the long delay.

One of your manifests had a typo, but it was easy enough to fix. Those MPDs using our own test segments are very helpful. Thanks!

We have reproduced the issue, but I suspect this use-case might conflict with another. I still have some digging to do.

@joeyparrish joeyparrish self-assigned this Dec 12, 2017
@joeyparrish
Copy link
Member

This seems to be specific to SegmentTemplate+duration. I'm fairly sure the bug is in the DASH parser, but the fix is more challenging than I expected.

@joeyparrish joeyparrish added type: bug Something isn't working correctly and removed needs triage labels Dec 12, 2017
@joeyparrish joeyparrish added this to the v2.3.0 milestone Dec 12, 2017
@joeyparrish
Copy link
Member

Several issues came up here.

First, in your "ABC" test manifest, the text segments had a duration of 60 inside a period of duration 20. This is an edge case we didn't handle correctly in the DASH parser, and it caused failures in StreamingEngine.

Second, the DASH parser didn't apply presentationTimeOffset correctly in the case of SegmentTemplate+duration.

Third, the "BAC" test manifest had text segments with a duration of only 20 seconds, even though the media segment was actually 60. This meant that after applying an offset of -20 or -40 seconds, everything went a little crazy. I fixed the manifest for this.

Here are the corrected versions of all three manifests, which I now have working locally:

https://storage.googleapis.com/shaka-demo-assets/_bugs/1164/1period.mpd
https://storage.googleapis.com/shaka-demo-assets/_bugs/1164/3periodsABC.mpd
https://storage.googleapis.com/shaka-demo-assets/_bugs/1164/3periodsBAC.mpd

@vickyvxr
Copy link
Author

I'm sorry about all the typos in the manifests, thank you very much for the corrected versions.
And I will check the bug correction to learn the best way to solve it!

Thanks for all!

@joeyparrish
Copy link
Member

The fix is in the master branch now. Please let us know if you have any questions!

joeyparrish added a commit that referenced this issue Dec 18, 2017
We were not previously applying presentationTimeOffset in
SegmentTemplate w/ the duration attribute.  This fixes the DASH parser
to correctly apply the offset in this case.

This also fixes an issue in which segment times could stretch past the
end of the period or even past the end of the presentation, causing
StreamingEngine to fail period transitions afterward.

Closes #1164
Closes #1163 (PR to address 1164)

Change-Id: Ib16fc2b65117557a4ad9a05adc4a07f8bc90fd3c
@joeyparrish
Copy link
Member

The fix has been cherry-picked for v2.2.9.

shaka-bot pushed a commit that referenced this issue Feb 1, 2018
We incorrectly added the presentationTimeOffset to the segment times as
a fix for #1164.  The correct fix is to use the include the PTO in the
time structure passed to the text parsers.  This is a partial revert
of 207505.

Issue #1164
Closes #1232

Change-Id: I1f2805e0dbdc44be71e2160b3d37a73732c97a4f
joeyparrish pushed a commit that referenced this issue Feb 1, 2018
We incorrectly added the presentationTimeOffset to the segment times as
a fix for #1164.  The correct fix is to use the include the PTO in the
time structure passed to the text parsers.  This is a partial revert
of 207505.

Issue #1164
Closes #1232

Change-Id: I1f2805e0dbdc44be71e2160b3d37a73732c97a4f
@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
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 type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants