Modifying the position of Youtube subtitles with TTML
Updated on / dernière mise à jour : 02/17/2023
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="http://www.w3.org/ns/ttml"
<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%"/>
<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…
- 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="http://www.w3.org/ns/ttml"
xmlns:tts="http://www.w3.org/ns/ttml#styling"> 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.
- 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.
- 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.
- 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.
- Free subtitle editing software also exists, notably Jubler, Open Subtitle Editor, Subtitle Workshop and Subtitle Edit.
TTML stands for Timed Text Markup Language, which is a standard XML-based markup language used for captioning and subtitling in videos. TTML is designed to create timed text tracks for multimedia content, which can be used for closed captions, subtitles and other text overlays on videos. The main advantage of using TTML is that it can be used with any media format, making it a versatile tool for content creators.
It allows users to add text to their videos to ensure that they are accessible to a wider audience, including those who are deaf or hard of hearing, those who speak a different language or those who are watching videos in noisy environments. TTML can also be used to create captions for live broadcasts, allowing viewers to follow along with the content in real-time.
Apart from TTML, there are other tools available that can also do transcription of videos. Here are a few examples:
- Amara: Amara is an open-source platform that allows users to create and edit captions and subtitles for videos. It supports multiple subtitle formats, including TTML, SRT and VTT.
- Rev.com: Rev.com is a transcription service that provides fast and accurate transcription of audio and video content. It uses human transcriptionists to ensure accuracy and can deliver transcripts in various formats, including TTML.
- Kapwing: Kapwing is a cloud-based video editor that provides a range of video editing tools, including the ability to add subtitles and captions to videos. It supports multiple subtitle formats, including TTML, SRT and VTT.
I hope this information can be useful.
Have fun with your projects!