MP4 timed text (tx3g)
tx3g identifies a 3GPP timed-text sample entry whose container timing and text modifiers describe a subtitle track.
tx3g is the sample-entry identifier for the 3GPP timed-text format commonly encountered in MP4 and 3GP subtitle tracks. Inspection tools can also label the decoded codec mov_text.
This is not a standalone SRT file hidden inside MP4. The track has container timing and a sample description, while its timed samples contain text and optional presentation modifiers.
| Component | Responsibility |
|---|---|
tx3g sample entry |
Default text box, style, font-table references and presentation flags |
| Container sample timeline | When each sample starts and how long it is presented |
| Text sample | A byte-length field, encoded text and any modifier boxes |
| Renderer | Decode and lay out the sample using its defaults and modifiers |
Bytes and characters are counted differently
A text sample starts with a 16-bit text-length field. That length counts the text bytes, not all modifier bytes and not the number of visible glyphs.
For the UTF-8 spelling café, the text occupies five bytes although it has four composed Unicode characters. Its two-byte length field plus text therefore occupy seven bytes before optional modifier boxes.
The 3GPP format supports UTF-8 and signaled UTF-16 text. Styling ranges use their defined character positions. A byte index into a UTF-8 string cannot be casually used as the position of a displayed character.
Modifiers can describe styled spans, highlighting, links or other supported behavior. The receiving player chooses the implementation of those defined features; the identifier tx3g alone does not mean that the track has only plain unstyled sentences.
Empty samples can represent the gaps
Take a track on a 1,000-unit-per-second time scale:
| Sample start | Duration | Text |
|---|---|---|
| 0 | 12,500 | Empty |
| 12,500 | 2,500 | The last train leaves at midnight. |
| 15,000 | 1,200 | Empty |
| 16,200 | 1,800 | Then we still have time. |
The empty sample starting at 15 seconds prevents the first sentence from remaining on screen until the next sentence. The timing comes from the container's sample schedule. Any edit-list mapping or other applicable track timing also needs to be applied.
A simple text extraction reconstructs cues from that schedule. It must account for empty text and sample duration rather than copying every packet into a visible subtitle line.
For an Emby MP4, container recognition and subtitle rendering are separate capabilities. A route can retain the track, convert its decoded text for the app, or render its presentation upstream. Its styled ranges and other modifiers determine which presentation details a simpler text conversion can retain.
See Also
- Timed Text Markup Language (TTML)
- Subtitle timestamps
- MP4 and the ISO Base Media File Format
- Time Bases