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

feat: support emsg box parsing #426

Merged
merged 19 commits into from
Feb 14, 2023
Merged

feat: support emsg box parsing #426

merged 19 commits into from
Feb 14, 2023

Conversation

adrums86
Copy link
Contributor

@adrums86 adrums86 commented Dec 29, 2022

Feature

Added basic fmp4 emsg box parsing for v0 and v1 boxes. Exposed a new mp4/probe function for extracting timed message data from emsg boxes getEmsgID3.
This will allow us to extract emsg timed metadata from fmp4/cmaf content, specifically ID3 frame data which is supported by various ad service integrations.

References:
https://aomediacodec.github.io/id3-emsg/
https://dashif-documents.azurewebsites.net/Events/master/event.html#event-metadata-timing
https://github.com/id3/ID3v2.4/blob/master/id3v2.40-structure.txt

Testing

Tested using mock data derived from the emsg spec, as well as manually tested real fmp4 segment data in the debug page.

@adrums86 adrums86 self-assigned this Dec 29, 2022
@adrums86 adrums86 marked this pull request as ready for review January 23, 2023 17:21
lib/mp4/probe.js Outdated Show resolved Hide resolved
lib/utils/string.js Outdated Show resolved Hide resolved
Copy link
Contributor

@wseymour15 wseymour15 left a comment

Choose a reason for hiding this comment

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

This looks great 👍 Parsing by bytes looks painful.. I'm sure that took some effort to figure out! +1 after some minor styling changes and possibly another test or two.

@adrums86
Copy link
Contributor Author

@wseymour15 good catch on the indentation inconsistencies, I was leaning on auto-detect in the IDE without realizing my default was 4 per tab 😅 . I added a couple more edge case tests for the c string util as well. Thanks for taking a look at this!

test/mp4-emsg.test.js Show resolved Hide resolved
lib/tools/parse-id3.js Show resolved Hide resolved
lib/tools/parse-id3.js Outdated Show resolved Hide resolved
test/mp4-emsg.test.js Show resolved Hide resolved
Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

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

@adrums86
Copy link
Contributor Author

adrums86 commented Feb 8, 2023

@brandonocasey Yeah, I noticed there was already some duplication between the aac timed metadata parsing and m2ts/metadata-stream.

this.push = function(chunk) {

I lifted as much common functionality from metadata-stream as I could, however since both aac and m2ts are accommodating partial segments, it seemed safer to leave the push implementations alone and implement extraction from full-segment fmp4 separately. There is likely room for further consolidation between all 3 implementations, however I think it makes sense to do that in a separate PR.

@adrums86
Copy link
Contributor Author

adrums86 commented Feb 9, 2023

@wseymour15 @dzianis-dashkevich I added some emsg validation and corresponding tests to account for malformed data and addressed the other comments. Thanks for taking a look at the revised PR!

@adrums86 adrums86 merged commit a8146c7 into videojs:main Feb 14, 2023
@adrums86 adrums86 deleted the emsg-support branch February 14, 2023 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants