-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Replace mux.js for CEA parsing #2648
Comments
During video playback, if the user switches the caption stream (e.g. CC1 to CC3 which changes languages), the first caption in the next fragment is missing. In fragmented MP4s, the end time of a caption is determined by the start time of the next caption. Thus for the last caption in a fragment, the end time cannot be determined until the next fragment is parsed. Before this fix: the clearing of the caption stream was being called from a chain of function calls originating from clearBuffer_() on the Media source engine. But clearing a buffer and resetting a caption stream are two independent operations. As a result, the caption parser was being reset (its buffer cleared) during video seeks, and during stream switches. This makes sense for video seeks, because the end time of the last caption in the fragment can't be determined if the entire presentation timestamp changes. However for stream switches, resetting the parser doesn't make sense. Clearing the caption parser during a stream switch would actually get rid of the last caption in that fragment (which wasn't emitted since its end time wasn't determined yet), and we would lose the data, causing the problem. The fix is to reset (and hence clear) the caption parser during seeks, but not during stream switches. Issue #2648
This is an MP4 Parser which extracts CEA-708 packets from Fragmented MP4 streams. The Closed Caption Parser (shaka.media.ClosedCaptionParser) will own this MP4 Parser, and will initialize it and call it as shown. As data comes in, the parser will parse this data, and the caption packets data then be returned in a callback (on708Data), as shown. Here, a theoretical decoder (future pull request, mentioned as a Todo comment) will decode and extract the parsed captions from these packets. Issue #2648
…ject#2648) added tkhd box parsing unit testing for mp4 box parsers moved mp4 box structs to lib/util inlined returns for mp4 boxes created mp4 parser to parse cea708 packets from mp4 streams (shaka-project#2648) tightened array out of bound checks added error code for invalid mp4 for cea packets refactored name of mp4 cea parser interface fixed a bug with increment ordering that affected time linting addressed mp4 cea parsing comments stylistic changes to mp4 cea parser improved mp4 parser comments and addressed pr review return caption packets as array instead of in a callback removed caption packets from class state to avoid clearing it in the middle of a parse
…ject#2648) added tkhd box parsing unit testing for mp4 box parsers moved mp4 box structs to lib/util inlined returns for mp4 boxes created mp4 parser to parse cea708 packets from mp4 streams (shaka-project#2648) tightened array out of bound checks added error code for invalid mp4 for cea packets refactored name of mp4 cea parser interface fixed a bug with increment ordering that affected time linting addressed mp4 cea parsing comments stylistic changes to mp4 cea parser improved mp4 parser comments and addressed pr review return caption packets as array instead of in a callback removed caption packets from class state to avoid clearing it in the middle of a parse Implemented CEA-608 decoder fix the diff fix build and style fixing removed new parser bug fix for fields
removed useless logs Added color support fixed up background attribute logic trim new lines on row ends and styling fix logic on clearing rollup captions when moving window hotfixes on decoder and tests fixed logic and added support for all charsets minor syntax fix renaming constants improve commenting, remove redundant comments move important hex into constants broke hex values in unit tests into constants comment fixing constant suffixes cleaned impl for streams/channel
@muhammadharis Do you plan to implement this for TS too? I ask this to know if the https://shaka-player-demo.appspot.com/docs/api/shaka.extern.html#.StreamingConfiguration
|
@avelad Currently, we do not plan to implement this for Transport Streams, only for MP4. As Joey mentioned in this issue, we don't plan to support TS streams long-run so we will continue using Mux.js for transmuxing. However, the |
During video playback, if the user switches the caption stream (e.g. CC1 to CC3 which changes languages), the first caption in the next fragment is missing. In fragmented MP4s, the end time of a caption is determined by the start time of the next caption. Thus for the last caption in a fragment, the end time cannot be determined until the next fragment is parsed. Before this fix: the clearing of the caption stream was being called from a chain of function calls originating from clearBuffer_() on the Media source engine. But clearing a buffer and resetting a caption stream are two independent operations. As a result, the caption parser was being reset (its buffer cleared) during video seeks, and during stream switches. This makes sense for video seeks, because the end time of the last caption in the fragment can't be determined if the entire presentation timestamp changes. However for stream switches, resetting the parser doesn't make sense. Clearing the caption parser during a stream switch would actually get rid of the last caption in that fragment (which wasn't emitted since its end time wasn't determined yet), and we would lose the data, causing the problem. The fix is to reset (and hence clear) the caption parser during seeks, but not during stream switches. Issue #2648
This pertains to #2648 (although this is a new feature, not a replacement) and #1404. A CEA-708 decoder that follows the CEA-708-E standard, decodes closed caption data from User Data Registered by Rec. ITU-T T.35 SEI messages, and returns them as cues in Shaka's internal cue format. Furthermore, this pull request fixes and cements some of the logic surrounding CEA-608 and CEA-708 tag parsing on the Dash Manifest Parser. Format: Similar to the CEA-608 decoder, cues are emitted in Shaka's internal format (lib/text/cue.js). This decoder makes use of nested cues. The top level cue is always a blank cue with no text, and each nested cue inside it contains text, as well as a specific style, or linebreak cues to facilitate line breaks. This also allows for inline style (color, italics, underline) changes. Details: - ASCII (G0), Latin-1 (G1), and CEA-708 specific charsets (G2 and G3) all supported. - Underlines, colors, and Italics supported, set as a property on each nested cue. - Positioning of text is supported. (Exception: In CEA-708 the default positioning is left, in this decoder it is centered.) - Positioning of windows not supported, but relevant fields that could be used to support this are extracted and left as a TODO.
This pertains to shaka-project#2648 (although this is a new feature, not a replacement) and shaka-project#1404. A CEA-708 decoder that follows the CEA-708-E standard, decodes closed caption data from User Data Registered by Rec. ITU-T T.35 SEI messages, and returns them as cues in Shaka's internal cue format. Furthermore, this pull request fixes and cements some of the logic surrounding CEA-608 and CEA-708 tag parsing on the Dash Manifest Parser. Format: Similar to the CEA-608 decoder, cues are emitted in Shaka's internal format (lib/text/cue.js). This decoder makes use of nested cues. The top level cue is always a blank cue with no text, and each nested cue inside it contains text, as well as a specific style, or linebreak cues to facilitate line breaks. This also allows for inline style (color, italics, underline) changes. Details: - ASCII (G0), Latin-1 (G1), and CEA-708 specific charsets (G2 and G3) all supported. - Underlines, colors, and Italics supported, set as a property on each nested cue. - Positioning of text is supported. (Exception: In CEA-708 the default positioning is left, in this decoder it is centered.) - Positioning of windows not supported, but relevant fields that could be used to support this are extracted and left as a TODO.
This pertains to shaka-project#2648 (although this is a new feature, not a replacement) and shaka-project#1404. A CEA-708 decoder that follows the CEA-708-E standard, decodes closed caption data from User Data Registered by Rec. ITU-T T.35 SEI messages, and returns them as cues in Shaka's internal cue format. Furthermore, this pull request fixes and cements some of the logic surrounding CEA-608 and CEA-708 tag parsing on the Dash Manifest Parser. Format: Similar to the CEA-608 decoder, cues are emitted in Shaka's internal format (lib/text/cue.js). This decoder makes use of nested cues. The top level cue is always a blank cue with no text, and each nested cue inside it contains text, as well as a specific style, or linebreak cues to facilitate line breaks. This also allows for inline style (color, italics, underline) changes. Details: - ASCII (G0), Latin-1 (G1), and CEA-708 specific charsets (G2 and G3) all supported. - Underlines, colors, and Italics supported, set as a property on each nested cue. - Positioning of text is supported. (Exception: In CEA-708 the default positioning is left, in this decoder it is centered.) - Positioning of windows not supported, but relevant fields that could be used to support this are extracted and left as a TODO.
This pertains to shaka-project#2648 (although this is a new feature, not a replacement) and shaka-project#1404. A CEA-708 decoder that follows the CEA-708-E standard, decodes closed caption data from User Data Registered by Rec. ITU-T T.35 SEI messages, and returns them as cues in Shaka's internal cue format. Furthermore, this pull request fixes and cements some of the logic surrounding CEA-608 and CEA-708 tag parsing on the Dash Manifest Parser. Format: Similar to the CEA-608 decoder, cues are emitted in Shaka's internal format (lib/text/cue.js). This decoder makes use of nested cues. The top level cue is always a blank cue with no text, and each nested cue inside it contains text, as well as a specific style, or linebreak cues to facilitate line breaks. This also allows for inline style (color, italics, underline) changes. Details: - ASCII (G0), Latin-1 (G1), and CEA-708 specific charsets (G2 and G3) all supported. - Underlines, colors, and Italics supported, set as a property on each nested cue. - Positioning of text is supported. (Exception: In CEA-708 the default positioning is left, in this decoder it is centered.) - Positioning of windows not supported, but relevant fields that could be used to support this are extracted and left as a TODO.
Have you read the FAQ and checked for duplicate open issues?
Yes
Is your feature request related to a problem? Please describe.
Using mux.js for transmuxing makes sense, as we do not want to support TS streams long-term. Using mux.js for CEA captions is different, since broadcast TV caption standards are not going away any time soon.
Describe the solution you'd like
We should own our own CEA parser so that apps do not need an additional dependency for caption parsing. We can keep mux.js as an optional dependency for transmuxing TS content.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: