Modifying the position of Youtube subtitles with TTML

Updated on / dernière mise à jour : 08/29/2022

Youtube allows the inclusion of subtitles for uploaded videos. Such subtitles are great for translating information or presenting additional content. They are also an important SEO element that can be beneficial in regard to the number of views videos can generate. If your video is in English, you may add subtitles in this language as well as many more languages. Youtube Studio has a very interesting option which allows content creators to automatically translate subtitles from the original version.

From the dashboard’s left menu, click on “Content”, select your video, then on the right side of the video details panorama, click on “Subtitles”. From there, you can either type your captions directly or upload a file. Once done, you’ll click on the “Done” button and your subtitles will be automatically integrated.

There is a problem though: you will not be able to modify the position of your subtitles through Youtube Studio if you type your captions directly. By default, they are positioned at the bottom and centered. If you want to align your subtitles differently or position them at the top or the middle, then you could use a Timed Text Markup Language file and upload it instead.

You can create such a file with Notepad and save it as a .ttml extension.

Here’s an example (i.e.: Captions.ttml)…

<tt xml:lang=”en” xmlns=””
<region xml:id=”rTop” tts:origin=”10% 10%” tts:extent=”80% 20%”/>
<region xml:id=”rMiddle” tts:origin=”10% 40%” tts:extent=”80% 20%”/>
<region xml:id=”rBottom” tts:origin=”10% 80%” tts:extent=”80% 20%”/>
<div xml:lang=”en“>
<p begin=”0:00:05.675” end=”0:00:15.000” region=”rTop”>
Input your first caption here (positioned at the top)…
<p begin=”0:02:42.000” end=”0:03:19.020” region=”rBottom”>
Then your second caption would go here (positioned at the bottom)…
<p begin=”0:08:00.000” end=”0:13:10.691” region=”rTop”>
And so on…

A few things to remember…

  1. Do not forget to include the correct xml:lang input. If your subtitles are for a video in English, then you should include <tt xml:lang=”en” xmlns=””
    xmlns:tts=””> AND<div xml:lang=”en“> in your .ttml file (as in the previous example). If your subtitles are for a video in French, then you would replace “en” with “fr“. A list of ISO 639-1 language codes can be found here.
  2. The format for the begin and end times is: 0:00:00.000. For example, 0:13:22.500 would begin (or end) at 13 minutes and 22.5 seconds.
  3. If you upload such a file for your initial video in English (via Youtube Studio’s subtitles’ creation panorama) and then translate automatically your subtitles to other languages, the .ttml coding shall not be replicated by Youtube Studio. Hence, you will have to upload a new .ttml file for every other languages used for subtitles.
  4. TTML is not the only closed caption and subtitle file supported by Youtube. They also accept other basic and advanced file formats such as RealText (.rt), WebVTT (.vtt) and Scenarist Closed Caption (.scc). A full list of supported files can be viewed here.
  5. Free subtitle editing software also exists, notably Jubler, Open Subtitle Editor, Subtitle Workshop and Subtitle Edit.

I hope this information can be useful.

Have fun with your Youtube projects!



Leave a Reply

Your email address will not be published. Required fields are marked *