What is MIME type "application/ttml+xml"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

application/ttml+xml is a MIME type for files written in the Timed Text Markup Language.
It is used to deliver subtitles, captions, and other time-based text for videos.
The format relies on XML, allowing text to be synchronized with media content.
Files that use this MIME type include formats like XML, TTML, DFXP, and DXFP.
This MIME type is based on standards set by the W3C. For additional details, visit the W3C TTML1 Specification.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: application/ttml+xml    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="application/ttml+xml">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'application/ttml+xml');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the primary purpose of the application/ttml+xml MIME type?

The application/ttml+xml MIME type indicates a file containing Timed Text Markup Language (TTML). It is primarily used to provide synchronized subtitles and captions for video content, supporting advanced features like styling, layout, and positioning that standard text captions might lack.

How do I configure Apache to serve TTML files correctly?

To ensure Apache serves .ttml or .dfxp files with the correct MIME type, add the following line to your .htaccess file or main configuration: AddType application/ttml+xml .ttml .dfxp. This prevents browsers from misinterpreting the file as generic XML or plain text.

How do I add support for application/ttml+xml in Nginx?

For Nginx, you should edit your mime.types file or the types block in nginx.conf. Add the line: application/ttml+xml ttml dfxp;. After saving the file, reload Nginx to apply the changes.

What is the difference between .ttml and .dfxp files?

DFXP (Distribution Format Exchange Profile) is essentially an older term used during the development of the W3C TTML standard. In practice, both .ttml and .dfxp extensions refer to the same XML-based captioning format and should both be served with the application/ttml+xml MIME type.

Why are my TTML subtitles not displaying in a web player?

Common issues include the server sending the wrong Content-Type (often text/xml instead of application/ttml+xml) or CORS (Cross-Origin Resource Sharing) errors. If your video and subtitles are on different domains, ensure the subtitle server sends the Access-Control-Allow-Origin header.

How does application/ttml+xml compare to text/vtt?

While text/vtt (WebVTT) is a simpler, text-based format widely supported by browsers for basic HTML5 video captions, application/ttml+xml is an XML-based format. TTML is more verbose but offers richer styling and metadata capabilities, making it a standard choice for broadcast industries and streaming services like Netflix.

Are there security concerns with TTML files?

Since TTML is an XML format, applications parsing it could be vulnerable to XML External Entity (XXE) attacks if not properly configured. Developers should ensure their XML parsers disable external entity resolution when processing untrusted TTML files.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.