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

Add CMAF ID3 metadata support #1

Open
wants to merge 5 commits into
base: feature/cmaf-cc
Choose a base branch
from

Conversation

victor-at-work
Copy link
Owner

This PR will...

Add ID3 metadata support for CMAF streams. This is dependent on video-dev#3016.

Why is this Pull Request needed?

ID3 metadata for CMAF is not currently supported.

Are there any points in the code the reviewer needs to double check?

Resolves issues:

video-dev#2360

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

@victor-at-work victor-at-work changed the base branch from feature/cmaf-cc to master December 9, 2020 14:12
@victor-at-work victor-at-work changed the base branch from master to feature/cmaf-cc December 9, 2020 14:14
@victor-at-work victor-at-work marked this pull request as ready for review January 6, 2021 08:05
@johndeu
Copy link

johndeu commented Jan 6, 2021

Curious why you chose to make this ID3 specific and not just add support for generic EMSG v1 with any scheme ID URL?
The goal of emsg is to support any schema URL, and not just ID3. That was the way it was intended in CMAF with HLS.

@victor-at-work
Copy link
Owner Author

victor-at-work commented Jan 8, 2021

@johndeu I don't have a good reason other than the fact that this was what my company project needed and what I added to our own fork. How do I make it more generic? Is it just removing the scheme ID URL check or is there a more generic spec I should be looking at? I'm only aware of https://aomediacodec.github.io/id3-emsg/ and https://aomediacodec.github.io/id3-emsg/.

@johndeu
Copy link

johndeu commented Jan 8, 2021

@victor-at-work The AOM spec that we created with Apple really just uses the Common Media Application Framework file format (CMAF) with the Event Message Box 'emsg' v1. If you look at the implementation of the Event Message box in CMAF, it is meant to be very generic. It has a "scheme id URI", which is supposed to be a unique URI namespace which defines what is in the payload of the box. In addition it has the presentation time, duration, unique id, and a value property that can all be filled out as well. The goal is to be a generic box, that has a payload, that is defined by the scheme URI (consider it a namespace).

For Apple, we wanted to define a specific URL that would be used to identify that the payload contained ID3v2 metadata.
That is why we published this document - https://aomediacodec.github.io/id3-emsg/
So the goal was to just define that URI and make sure it was clear what the semantics were for signaling ID3 in an emsg box.
This is consistent with the way that Apple defined timed metadata support for Transport Stream as well.

My comment is that we should not introduce code to HLS.js that precludes the ability to fire other custom defined events as well.
Meaning we should not limit the user from listening to other emsg event scheme id's that may be in the CMAF content. If we see another emsg box, with a different scheme id - we should also fire an event from the player with the information in that box, and let the developer handle the parsing of the data based on the scheme id. Those that want to listen for ID3v2 can do so. Those that want to listen to other defined message payloads can then also do so.

@@ -205,7 +201,7 @@ export function parseVideoSegmentTextTrackSamples (data, videoTrackId) {
});
}

export function parseVideoSegmentId3TrackSamples (data) {
export function parseEmsg (data) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still no support for emsg v1 right? Can we someone add that to this PR?

https://aomediacodec.github.io/id3-emsg/
"One or more Event Message boxes (‘emsg’) [CMAF] can be included per segment. Version 1 of the Event Message box [DASH] must be used."

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand what you're saying? This is v1 right?

@@ -8,6 +8,10 @@ import ID3 from '../demux/id3';
import { sendAddTrackEvent, clearCurrentCues, getClosestCue } from '../utils/texttrack-utils';

const MIN_CUE_DURATION = 0.25;
const VALID_ID3_SCHEME_ID_URIS = [
'https://aomedia.org/emsg/ID3',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why even include AOM ID3 scheme here if the v1 emsg box is not yet supported?

@johndeu
Copy link

johndeu commented Jul 15, 2021

On reading the spec, the v0 emsg box uses relative timestamp (delta) v1 uses absolute timestamp 64-bit.
I'm not 100% sure if the work is done here to support that use of absolute timestamps over relative.

Some sort of absolute to relative time mapping would be needed if the client receives the emsg data and map it back to the video time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants