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

Parsing and surfacing prft mp4 box information via player events #4382

Closed
dave-nicholas opened this issue Aug 2, 2022 · 3 comments · Fixed by #4389 or #4424
Closed

Parsing and surfacing prft mp4 box information via player events #4382

dave-nicholas opened this issue Aug 2, 2022 · 3 comments · Fixed by #4389 or #4424
Assignees
Labels
priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@dave-nicholas
Copy link
Contributor

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

Additional context

We (SKY) would like to propose a change to the streaming engine in where we would parse and surface prft mp4 box information via a player event. We are happy to raise the PR.

Is your feature request related to a problem? Please describe.

We have a requirement for seeking to an exact date time within a live event (a goal for example).
To do this we need to know the program start date (ProducerReferenceTime).
We want to be able to deduce the program start date of a live event using PRFT boxes.

Describe the solution you'd like

The PRFT box contains ntp_timestamp (a UTC time in NTP format corresponding to decoding_time) and media_time (the same time as ntp_timestamp, but in the time units used for the reference track, and is measured on this media clock as the media is produced.), we can use these values in conjunction with the timescale to calculate the program start date.

Program start date = (ConvertToUTC(ntp_timestamp) - (media_time / timescale))
  • Shaka will surface a new player event prft
  • The prft event will contain
{
 wallclocktime, // a utc timestamp representation of the ntp_timestamp
 mediaTime, // media_time
 timescale, // the current timescale 
}
  • Only the first video PRFT box would need to be surfaced
  • To know the timescale we would need to add this value to the segment reference.
  • The feature will be subscribe-able via feature flag on the streaming config

example solution in our own fork

Describe alternatives you've considered

N/A

@dave-nicholas dave-nicholas added the type: enhancement New feature or request label Aug 2, 2022
@github-actions github-actions bot added this to the Backlog milestone Aug 2, 2022
@joeyparrish
Copy link
Member

That all seems reasonable. I'm not sure if timescale should be on SegmentReference, but I don't have any other concerns.

Is SegmentReference where you put timescale due to potential timescale differences across periods/discontinuities? If that's the case, could timescale live in InitSegmentReference, which is shared among all references in a period/discontinuity? My understanding is that timescale is parsed from the init segment anyway.

@joeyparrish joeyparrish added the priority: P3 Useful but not urgent label Aug 3, 2022
@joeyparrish
Copy link
Member

I'd like to find an agreement with you on timescale, but otherwise I think a PR for this would be great.

@dave-nicholas
Copy link
Contributor Author

The only consideration that I had was timescale differences between bitrate, so initSegmentReference would work fine I think. I will get a PR together. Thanks.

@avelad avelad linked a pull request Aug 9, 2022 that will close this issue
@avelad avelad closed this as completed in 89777dd Sep 14, 2022
@avelad avelad modified the milestones: Backlog, v4.3 Sep 14, 2022
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Nov 13, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2022
gkatsev pushed a commit to sky-hugolima/shaka-player-contrib that referenced this issue Dec 6, 2023
* Cherry Pick sky-uk/shaka-player/pull/15

* Merge pull request shaka-project#24 from sky-uk/support-hls-timedevents-safari

Adds support for parsing and emitting HLS timed metadata (daterange) on Safari

* Merge pull request shaka-project#31 from sky-uk/fix-safari-track-changes

Fixed missing srcEquals checks when playing live on Safari

* Merge pull request shaka-project#33 from sky-uk/improve-logging

[NO VERISON] Send contentType when throwing the 3015 error

* Merge pull request shaka-project#35 from sky-uk/unit-test-fix

Fixes unit tests

* Returns the correct hls date-range endTime, this was causing beacons not to get fired on the SDK (shaka-project#73)

* Fixes calcule for the endTime, this was causing beacons not to get fired

* Tries to add a first approach to the unit test for the added behaviour

* Revert "Tries to add a first approach to the unit test for the added behaviour"

This reverts commit d67bfbde312226f15f9278b0330e1b5328a8ed68.

Co-authored-by: Hugo Lima <hugo.lima@sky.uk>

* Add recognition for PS4 and Llama (shaka-project#79)

* add recognition for PS4 and Llama

* lint

* more lint :(

added platform support that was missed in sky-uk/shaka-player#79

* [MINOR] workaround magentaTv EME empty key status map key id (shaka-project#83)

* workaround magentaTv EME empty key status map key id

* linting

* Update lib/player.js

Co-authored-by: Giorgio Gamberoni <giorgio.gamberoni@gmail.com>

* more magenta fixes

* magenta specific workaround

Co-authored-by: Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
Co-authored-by: Jacob Trimble <modmaker@google.com>

* [sky-uk/bugfix] Internal retry - preservation of active media key sessions between playouts (shaka-project#90)

* New API to preserve media key sessions and pass through the config

* Remove unneeded safety function

* Unit tests and minor changes

* use register fn instead of config + unit tests

* simplify if/else scenario

* Allow same audio/text language for initial track (shaka-project#91)

* Allow same audio/text language for initial track

* Change variable name

* [sky-uk/bugfix] Add config option to override Dolby Vision codecs with HEVC counterparts (shaka-project#97)

* Add logic to replace DV codec with HEVC codec needed to get playback on Xbox

* Unit tests

* More detailed comment

* Added Shaka telemetry (shaka-project#105)

* [WIP] Added new stat properties

* [WIP] Added new stat properties

* Undo port change

* Fixed typing

* Add non fatal error/gap counts

* Fixed unit tests

[google/feature] Stats for manifest download and parse time (shaka-project#108)

* Stats for manifest download and parse time

* Unit tests

* Add parse and download data for initial HLS request

* rename magenta to zenterio (shaka-project#112)

* Merge pull request shaka-project#51 from sky-uk/HDCP_EDGE

* [sky/bugfix] [MINOR] Save original presentation start date (shaka-project#113)

* Save original presentation start date

* Fix unit tests

* Add unit tests

* Default Lang to 'und' (shaka-project#121)

* feat: Parse and surface "prft" boxes as events (shaka-project#4389)

Closes shaka-project#4382

* Only parse src= manifest when not playing an mp4 (shaka-project#93)

* Only parse src= manifest when not playing an mp4

* Indentation

* Fix unit test on Edge

navigator.userAgent is readonly on Edge

* Merge pull request shaka-project#30 from sky-uk/timeout-handling-improvements

Timeout handling improvements

* [NO VERSION] fix Chrome local tests

* Merge pull request shaka-project#40 from sky-uk/timeout-handling-improvements-2

[MINOR] Improve timeout handling logic

* Add code owners file

* Adds option to select audio track based on channel count criteria (shaka-project#147)

Co-authored-by: João Nabais <joao.nabais@sky.uk>

* feat: Caching and other efficiency improvements for mcap polyfill (shaka-project#151)

* create caching mechanism for requestKeySystemAccess

* fix test

* pr amends

* remove console log

* Fixes broken Playready DRM hack for Edge (shaka-project#158)

* Fix broken Playready pre-roll hack on Edge Chromium (Win)

* Some more unit tests

* fix: add MIME type for HTML5 tracks (shaka-project#5452)

* feat(dash): Improve DASH SegmentTemplate performance with on-demand segment references (shaka-project#5061)

This is a performance optimization intended to reduce the Video Start
Time for DASH streams, both VOD and Live, by reducing the amount of
processing done during manifest parse time. This is especially effective
for long multi-period assets, assets with many variants, or on low end
devices in general. I've provided some measurements showing the
performance improvements at the conclusion of this PR.

Currently, during manifest parse time for a Segment Template, Shaka will
loop through the entire timeline and create segment references for each
timeline entry. For a long asset, or an asset with many tracks, this is
a significant amount of processing.

I've created a new entity called the Timeline Segment Index that extends
the SegmentIndex interface. The purpose of the Timeline Segment Index is
to ingest a timeline during construction, and then use that information
to build Segment References only on demand. This removes the need to
parse the entire timeline and create all of the Segment References
during parse time.

The effects of this change aren't quite as apparent on desktop web
browsers, given their speed and power. This improvement really shines on
lower end TVs on assets with a long timeline.

DASH parsing speed-ups in some cases can be as much as 40%.

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>

* feat: Allow add extra features to MediaSource.addSourceBuffer (shaka-project#4527)

* feat: Allow Codec Switching (shaka-project#162)

* Codec Switching

* build fixes

* build fixes

* Fix typings

* Revert "build fixes"

This reverts commit 1adf08e4a35975665518f949d98694e8c66c42d7.

* re-implement build fixes

* Moved decision logic on the streaming engine about needing to abort network operations to the media source engine

* unit test fixes, add demo config section

* add needsReload to fake media source engine

* demo cleanup. build and unit passing

* Fixed missing restore of source buffer parameters after codec switching reload

* Media Source Engine unit tests

* Stream Util unit tests

* Fix unit tests

* Fix reset mediasource after addsourcebuffer test

* Improve test

* build and unit fixes

* fix typo

Co-authored-by: Hugo Lima <hugo.lima@sky.uk>
Co-authored-by: Dave Nicholas <davenicholasuk@gmail.com>

* Add logging for videoElement error property (shaka-project#168)

* initial buildable patch changes

port over more improvements

remove testing hacks

remove comments

add unit tests

wipe segmentinfo when not patch

fix jsdoc formatting

fix typedef formatting 2

remove patch manifest adapter

mpd patch: stop updates after transition to static

enhance dynamic->static test

fix some small issues

* Codec Switching Hotfix (shaka-project#191)

* update to reset captions on any codec switch. update demo app to test codec switching and captions.

* codec switch add all sourcebuffers before seek

* Update lib/media/media_source_engine.js

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* comment resolutions

* revert package-lock.json

* remove captions reset

* update for comments

* test fix

* cleanup to address comment

* immediate cleanup of event listener to address memleak concern

---------

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* Changes player.selectAudioLanguage to accept an audio codec preference (shaka-project#200)

* Changes selectAudioLanguage to accept a codec preference for codec switch scenarios where the same audio track is available across more than one codec

* Fix default parameter value

* Update lib/media/adaptation_set_criteria.js

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

---------

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* [PBSCVJS-1818] Add support for multiple robustness levels (shaka-project#185)

* add support for multiple robustness levels

* drm engine unit test

* address comments

* delete useless comment

* Configuration for additional key restriction statuses (shaka-project#203)

* Add configurable restricted statuses

* Revert debug

* Minor refactor

* Revert

* Update lib/player.js

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* Update lib/player.js

Co-authored-by: Dave Nicholas <davenicholasuk@gmail.com>

---------

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>
Co-authored-by: Dave Nicholas <davenicholasuk@gmail.com>

* feat: Raise fatal error on linear manifest request update failure (shaka-project#5138)

We (Sky/Peacock) required the ability to try a different ad stitched
manifest upon a manifest request update failure.

After the initial retry parameters (timeouts and retries) have been
exhausted, error immediately and not continue to retry with the same
manifest.

* fix(DASH): Fix bufferBehind with image tracks regression (shaka-project#5210)

A recent change to allow for on-demand segment references (shaka-project#5061) ended up causing a
regression with an older issue (shaka-project#4717), where the presence of an image track overrides
`bufferBehind` behavior.
This fixes the segment template handler to properly account for image tracks, once again.

* Build optimisations & bundles for propositions (shaka-project#207)

* Fix existing build types

* Parametrize output lang & change default to ES5

* Add custom sky builds

* add propositions

* clean up

* fix cmd

* fix tests

* fix cmd again

* typo

* Fix CEA support without text plugins

* Reduce number of builds

* CircleCI fix

* remove @text from @sky-dash

* Reduce required polyfills

* do not exclude anything in sky builds

* chore: Fix core build without dash (shaka-project#5289)

- Move TimeRange from shaka.dash.MpdUtils to
shaka.media.PresentationTimeline
- Move AccessibilityPurpose from shaka.dash.DashParser to
shaka.media.ManifestParser

With these changes, core Shaka Player can be built without the dash
module.

* fix package issues (shaka-project#219)

* fix package issues

* clean before publish

* [PATCH][PBSCVJS-2654] Fix for codec switching playing states (shaka-project#229)

* fix for pause related issues with codec switching

* use event manager

* Update test/media/media_source_engine_unit.js

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* Update lib/media/media_source_engine.js

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* fix broken test

---------

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* Uses preferredAudioCodecs when selecting the initial adaptation set (shaka-project#230)

* Codec switching error 3014/3016 fix (shaka-project#228)

* Codec switching 301x fix

* add unit test

* add all-es2015 and hls-es5 targets (shaka-project#232)

* ABR heuristics support (shaka-project#236)

* Store network request start time

* Configure abr manager with player instance

* linting fix

* Adds latency to network segment download progress udpates (shaka-project#240)

* 3.3.10-v21

* Revert "3.3.10-v21"

This reverts commit 312b9e6de98d0e5b48f75be7eb90545c958088df.

* Adds latency to network segment download progress udpates

* Exposing safeMargin on selectAudioLanguage (shaka-project#239)

* Exposing safeMargin on selectAudioLanguage

* Propagate preferredKeySystems to getDecodingInfos (shaka-project#252)

* propagate preferredKeySystems to getDecodingInfos

* simplify checking is key system satisfied

* feat: add originalLanguage to the Track (shaka-project#259)

* feat: add originalLanguage to the Track

* add more tests

* exposed segmentDownloaded event to provide additional information for… (shaka-project#237)

* exposed segmentDownloaded event to provide additional information for starting bitrate

* moved ondownloadComplete logic from http_fetch_plugin to networking_engine

* removed unnecessary latency Calculation  since it is already calculated in request.timeToFirstByte

* Correcting type for requestToFirstByte for thrid parameter

* [Minor][PBSCVJS-3154] Filter variants by DASH adaptation set ID (shaka-project#261)

* Initial

* Filter variants by group ID if present

* Add dash parser unit test

* Revert package

* Remove console

* Revert player

* Update test/test/util/manifest_generator.js

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* Addressing comments

---------

Co-authored-by: Wojciech Tyczyński <wojciech.tyczynski@sky.uk>

* Run tests on Jenkins (shaka-project#257)

* jenkins test

* dir string

* fix docker

* fix docker

* try different agent

* dummy commit for dummy github

* do not call notifyPullRequestCheck

* add docker args

* docker docker

* no docker

* ...

* uncomment

* fix paths

* try set path differently

* try not to use docker

* install npm

* correct nvm path

* change script rights

* change num of steps

* prosze

* try to publish status

* move def above pipeline

* change hash env

* find node as in other repos

* syntaxxx

* one last try

* try to simplify script

* lint stage

* try to run unit tests

* use docker for browser tests

* reuse node

* Revert "reuse node"

This reverts commit 60854d02e0f352627812f944c751300240bc63ed.

* do not use nvmrc

* remove nvmrc file

* dockerfile 2nd attempt

* remove label

* use builtin

* volume name too short...

* maybe without args

* adjust script

* use error clause

* check unit tests with custom launcher

* fix config

* remove docker compose

* use updated version of karma-local-wd-launcher

Jenkins auto release (shaka-project#263)

* let us see what happens

* comma

* more comma

* change request fix

* test reading commit message

* how come

* caseSensitive

* [PATCH] test valid message

* small updates

* fix case insensitivity

* fix matching branches

[NO VERSION] Add PR Title validator (shaka-project#266)

* add pr title validator

* trigger new build

* remove CircleCI

[NO VERSION] Cleanup Jenkins workspace after build (shaka-project#269)

[PATCH] add credentials to github for npm version call

[PATCH] add git credentials to Dockerfile

[PATCH] add npmrc file

[PATCH] add npmrc file

fix jenkins push (shaka-project#271)

* Fix tests

* [PATCH][4.0.0][PBSCVJS-3541] Consider max bitrate when determining the best audio group (shaka-project#273)

* Consider max bitrate when determining the best audio group

* Adjust logic

* Make sure ABR is enabled

* Ensure private

* [PATCH][PBSCVJS-3541][4.0.0] Unify code path between start-of-stream and mid-stream bandwidth capping (shaka-project#275)

* Consider max bitrate when determining the best audio group

* Adjust logic

* Make sure ABR is enabled

* Ensure private

* Consider channel count with max bandwidth in adaptation set criteria

* Use bitrate cap more exensively in adaptation set criteria

* Add config

* Config tests

* Address comments

* Revert demo app change

* Variable name change

* Resore selectVariantTrack and refactor selectAudioLanguage

* add 4.2.12 branch to Jenkins

* disable flaky test

* reject ts defs

* redefine custom builds

* jenkinsfile fix for creating an initial version

* disable screenshot tests

* add esvm cache handling

* [NO VERSION] add HEAD to git push

* Fix media-capabilities on native Safari playabck

* Rename Llama to SkyGlass

* HLS: do not parse drm info in restricted mode

* [PATCH][PBSCVJS-3586] Fix for codec switch before playback has begun (shaka-project#282)

* check to see if playback has begun before disabling autoplay

* add tests and tidy

* [PATCH] fix text track selection on Safari (shaka-project#287)

* [MINOR][PBSCVJS-3783] Prefer video over audio when choosing an audio codec (shaka-project#294)

* Separate preference based criteria into its own package, add replacement for sky along with sky specific unit test setup

* Update jenkins

* remove buffers before a switch (shaka-project#296)

* Merge pull request shaka-project#49 from sky-uk/fps-drm-engine-2

Replaces the generic drm engine for safari+fairplay with a custom one…

* Reduce hls build for now

* expose max segment duration for thumbnails

* [MINOR] Expose debug package (shaka-project#298)

* Expose debug

* Fix formatting

* SelectAudioLanguage should not select an unplayable variant if possible (shaka-project#301)

* fix test compilation

* unit tests fix

* Distribute lib (shaka-project#302)

---------

Co-authored-by: Nick Michael <nickmichael@live.co.uk>
Co-authored-by: Hugo Lima <hugo.lima@sky.uk>
Co-authored-by: João Nabais <joao.nabais@sky.uk>
Co-authored-by: Alexander Field <amfio@users.noreply.github.com>
Co-authored-by: Ivan Simeonov <Vankatas@users.noreply.github.com>
Co-authored-by: Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
Co-authored-by: Jacob Trimble <modmaker@google.com>
Co-authored-by: Nick Michael <nick-michael@users.noreply.github.com>
Co-authored-by: Tiago Lopes <tiago.m_lopes@hotmail.com>
Co-authored-by: David Pfister <david.pfister@sky.uk>
Co-authored-by: Matthew King <matthew.king4@sky.uk>
Co-authored-by: Nick Crast <nrcrast@gmail.com>
Co-authored-by: Dave Nicholas <davenicholasuk@gmail.com>
Co-authored-by: Tom Haines <thomas.haines@sky.uk>
Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
Co-authored-by: Tom Johnson <114496687+tjohnson-nbcuni@users.noreply.github.com>
Co-authored-by: Tiago Lopes <tiago.lopes2@sky.uk>
Co-authored-by: rafael775 <55398776+rafael775@users.noreply.github.com>
Co-authored-by: Davide Zordan <107633045+DavideZordanSkyDev@users.noreply.github.com>
Co-authored-by: Avinash Bodepudi <95775730+AvinashBodepudi@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
3 participants