Skip to content

Add Subtitles asset type#178

Merged
Fweddi merged 1 commit into
mainfrom
fp/add-subtitle-asset-type
Sep 2, 2025
Merged

Add Subtitles asset type#178
Fweddi merged 1 commit into
mainfrom
fp/add-subtitle-asset-type

Conversation

@Fweddi
Copy link
Copy Markdown
Contributor

@Fweddi Fweddi commented Sep 2, 2025

Why are we doing this?

We are adding subtitles to loops. The intended solution is to provide an m3u8 which has an internal reference to a vtt file, but we want to fallback to providing an mp4 alongside the standalone vtt file. To do so we need to extend the AssetType model of the Media atom.

Is this future proof?

We considered that in future, we might also want to model a Captions asset type. We debated whether a Text asset type would be more generic, but we would then have to add an optional field on the Asset to handle whether it was Captions or Subtitles (which would be awkward as it wouldn't apply to videos and audio).

We also discussed how we could model the language of the subtitles. We could model this directly on the Asset, rather than AssetType. A Language field could just as easily apply to Video and Audio as it would to Subtitles. This is not needed for now - but you never know!

For these reasons we think going for a Subtitles AssetType is a suitable approach - it meets the current needs and is future compatible (we can always add a fourth type, Captions, if we ever need to disambiguate between Captions and Subtitles).

@Fweddi Fweddi requested review from a team as code owners September 2, 2025 13:40
@Fweddi Fweddi self-assigned this Sep 2, 2025
We considered that in future, we might also want to model a Captions asset type. We debated whether a Text asset type would be more generic, but we would then have to add an optional field on the Asset to handle whether it was Captions or Subtitles (which would be awkward as it wouldn't apply to videos and audio).

We also discussed how we could model the language of the subtitles. We could model this directly on the Asset, rather than AssetType. A Language field could just as easily apply to Video and Audio as it would to Subtitles. This is not needed for now - but you never know!

For these reasons we think going for a Subtitles AssetType is a suitable approach.

Co-authored-by: Andy Noton <andy.noton.contractor@guardian.co.uk>
@Fweddi Fweddi force-pushed the fp/add-subtitle-asset-type branch from 2e864a5 to ea8c667 Compare September 2, 2025 13:44
AUDIO = 0,
VIDEO = 1
VIDEO = 1,
SUBTITLES = 2
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To play devils argument https://www.w3schools.com/tags/att_track_kind.asp shows other 'kinds' of text we could have:


captions | The track defines translation of dialogue and sound effects (suitable for deaf users)
chapters | The track defines chapter titles (suitable for navigating the media resource)
descriptions | The track defines a textual description of the video content (suitable for blind users)
metadata | The track defines content used by scripts. Not visible for the user
subtitles | The track defines subtitles, used to display subtitles in a video

Copy link
Copy Markdown
Member

@JustinPinner JustinPinner left a comment

Choose a reason for hiding this comment

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

I think this looks safe. The AssetType is a property of MediaAtom, so it is ok to exist in its own right at that level. It extends the existing definition, so that is also safe, and this library must be imported by consumers before it can be effective, so that's safe too. All in all... 👍

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.

2 participants