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

The last image in the thumbnails is not always correct #3517

Closed
avelad opened this issue Jul 9, 2021 · 12 comments
Closed

The last image in the thumbnails is not always correct #3517

avelad opened this issue Jul 9, 2021 · 12 comments
Assignees
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@avelad
Copy link
Collaborator

avelad commented Jul 9, 2021

Have you read the FAQ and checked for duplicate open issues? Yes

What version of Shaka Player are you using? 3.1.1

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? Both

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using?
Chrome 91 macoS 11.4

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

I'll send a email

What configuration are you using? What is the output of player.getConfiguration()?

Default

What did you do?

Load a stream with thumbnails as matrix, ah get the last position with player.getThumbnails

What did you expect to happen?
The thumbnail position returned is correct

What actually happened?

The thumbnail position returned is not correct

Example:
Stream duration: 1460
Number of images: 2

First image
Start: 0
End: 1000
image

Second image
Start: 1000
End: 1460
image

The stream duration is 1460, but the thumbnail when using a matrix, the duration of the image track may exceed the duration of the audio/video to be able to fill the matrix correctly. In this case the second image ends in 2000

This is a problem that only occurs in DASH using a matrix.

@avelad
Copy link
Collaborator Author

avelad commented Jul 9, 2021

@paulJordaan do you have the same issue?

@paulJordaan
Copy link
Contributor

Personally, I have only tested with the following testing assets and I think they had full image matrixes present so I did not run into this edge case.

If you could share the manifest you are using in this case I can assist with further troubleshooting.

@avelad
Copy link
Collaborator Author

avelad commented Jul 9, 2021

@paulJordaan I can share privately. Do you have an email to send it to?

@paulJordaan
Copy link
Contributor

Great, you can send to pdjordaan@gmail.com

@avelad
Copy link
Collaborator Author

avelad commented Jul 9, 2021

Done!

@paulJordaan
Copy link
Contributor

paulJordaan commented Jul 13, 2021

@avelad I've been looking at this issue and hoping you can help me with a question I have.
Do you know if it is possible to access the duration of the Imagetracks as contained in the manifest?

<AdaptationSet id="4" group="5" mimeType="image/jpeg" contentType="image">
      <SegmentTemplate timescale="1000" duration="1000000" media="DLVY1581840855002521-$RepresentationID$-scale=1000-$Number$.jpg" />
      <Representation id="thmb_2000_THMB=6" bandwidth="2000" width="1600" height="900">
        <EssentialProperty schemeIdUri="http://dashif.org/guidelines/thumbnail_tile" value="10x10" />
      </Representation>
    </AdaptationSet>

Having access to this value will allow us to calculate the duration of a single thumbnail window ie 10s and from there correctly calculate the value of total images available in a thumbnail matrix. ie

Duration for Representation = 1000s
Duration for a single thumbnail = TotalDuration / Number of thumbnails in matrix (rows x cols)
                                                     = 1000 / 100
                                                     = 10s
                                                     
When we have the duration of a single thumbnail we can calculate the real number of thumbnails available for a segment
Duration of the second image = end - start
                                                   = 1460 - 1000
                                                   = 460s
                                                   
460 / 10s = 46 thumbnails

Currently totalImages is calculated as cols*rows which gives us false values as the size of the grid does not directly relate to the duration of the segment

@avelad
Copy link
Collaborator Author

avelad commented Jul 13, 2021

@joeyparrish can you help us with it?

@joeyparrish
Copy link
Member

Here's what I'm seeing with the content @avelad sent:

  1. The content duration (mediaPresentationDuration in the MPD) is 1460.
  2. The image stream has duration 1000000, timescale 1000, meaning 1000s segments.
  3. There are therefore only 2 segments, the second of which is full of blank space not used for thumbnails.
  4. Calling player.getThumbnails(/* id / 6, / time */ 0) gives me the first segment, position 0,0.
  5. Calling player.getThumbnails(/* id / 6, / time */ 1000) gives me the second segment, position 0,0.
  6. Calling player.getThumbnails(/* id / 6, / time */ 1460) gives me null.

So we're getting the correct thumbnail, we just need to know how long to show it.

The duration of each segment is known to the manifest (in SegmentReference, 1000 in this case). The duration of each thumbnail in the segment is the segment duration / total images in the grid (including blank ones). We can compute this and expose it through the Thumbnail interface.

I've got a draft locally which I will try to get through code review today.

@joeyparrish joeyparrish self-assigned this Jul 13, 2021
@joeyparrish joeyparrish added type: bug Something isn't working correctly priority: P2 Smaller impact or easy workaround and removed needs triage labels Jul 13, 2021
@joeyparrish joeyparrish added this to the v3.2 milestone Jul 13, 2021
@joeyparrish
Copy link
Member

Ah, now I see it's not quite as trivial as I thought. There's an edge case, which is that the segment duration of the last segment is clipped to the media duration. This results in a calculated thumb duration of 4.6 seconds instead of 10, since the last segment is clipped to 460 seconds to match the end of the presentation.

@joeyparrish
Copy link
Member

This might get fixed today, or maybe tomorrow. Since the thumbnail feature is broken without this fix, I'll hold v3.2 for another day to make sure this is in.

@joeyparrish joeyparrish added priority: P1 Big impact or workaround impractical; resolve before feature release and removed priority: P2 Smaller impact or easy workaround labels Jul 13, 2021
@avelad
Copy link
Collaborator Author

avelad commented Jul 13, 2021

It's really only broken when you don't use a 1x1 matrix. When I did the initial implementation, my streams used 1x1, and the Demo ones don't have this case.

Note: I agree with you that putting it in 3.2 would help me avoid workarounds.

Thanks @joeyparrish !

@joeyparrish
Copy link
Member

I have a fix in review. Thanks!

joeyparrish added a commit that referenced this issue Jul 14, 2021
Thumbnail segments may be structured for a certain grid size and
duration, but the segment references may have their duration truncated
due to the end of a period or the end of the presentation.  This was
causing us to calculate the wrong duration for those individual
thumbnails, and therefore return the wrong
thumbnail.

We also did not have any way to indicate to an application how long a
thumbnail should be shown.

This fixes the duration calculation by retaining the original,
untruncated duration in SegmentReference.  This also exposes startTime
and duration information on the Thumbnail object, so that applications
know when/where and how long to show a given thumbnail.

Closes #3517

Change-Id: I84aa7705a19691fc6ae68eee9944fecbd7067fe0
joeyparrish added a commit that referenced this issue Jul 14, 2021
Thumbnail segments may be structured for a certain grid size and
duration, but the segment references may have their duration truncated
due to the end of a period or the end of the presentation.  This was
causing us to calculate the wrong duration for those individual
thumbnails, and therefore return the wrong
thumbnail.

We also did not have any way to indicate to an application how long a
thumbnail should be shown.

This fixes the duration calculation by retaining the original,
untruncated duration in SegmentReference.  This also exposes startTime
and duration information on the Thumbnail object, so that applications
know when/where and how long to show a given thumbnail.

Closes #3517

Change-Id: I84aa7705a19691fc6ae68eee9944fecbd7067fe0
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Sep 12, 2021
@shaka-project shaka-project locked and limited conversation to collaborators Sep 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release 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

4 participants