Adding Subtitles to Media

How To - Adding Subtitles to Media

It is occasionally necessary to add subtitles to videos. This may be for accessibility reasons or to aid non-native speakers of the language.

What are Subtitle Files?

Generally, subtitles are stored in a separate file from the video. Video systems like Kaltura and Youtube use both a video file and a subtitle file to produce the subtitle experience you are used to.

The two subtitle file formats you are most likely to work with are .srt and .vtt. Both contain the same data (the text to display and the timestamps corresponding to each line of text) in a slightly different format.

Creating Subtitle Files

Although there are numerous options for creating subtitle files, the recommended program is Aegisub (http://www.aegisub.org/).

Using Aegisub

Aegisub’s site contains detailed documentation on its use, but the basic steps are as follows:

  1. In the “Video” menu bar, choose “Open Video…”

  2. Select the video you want to add subtitles to.

  3. In the subtitle box, set the time that the subtitle should start displaying and the time that it should stop displaying, in the boxes circled below.

  4. In the large text box, enter the text for the subtitle for this timestamp.

  5. Click the green check box button to confirm this subtitle.

  6. Repeat this process for each piece of text to display.

Viewing All Subtitles

As you go, you can see all created subtitles and play the video with them to ensure the timings are correct. The set of created subtitles will appear in a window like the one shown below.

Notes:

  • Clicking on a subtitle will let you edit it.

  • CPS stands for characters per second. This is a quick metric to determine if there is too much text for users to read in the time that the subtitle is on the screen. A red box indicates that this may be the case.

Saving Subtitles in Aegisub

When you are done creating and editing your subtitles, you will want to save your subtitles in a useful format.

  1. Go to the “File” menu.

  2. Select “Export Subtitles…” (not “Save Subtitles”).

  3. In the window that pop up, select “Export…”

  4. Choose a file name ending in “.srt” and save.

While you may select “Save Subtitles” as well, this is unnecessary and does not replace the export step.

Adding Subtitles to YouTube

If you want to upload a video to YouTube with subtitles, you may use the .srt file created with Aegisub.

  1. Sign in to the Youtube account you would like to use to upload videos.

  2. Click the circle in the top right and click "YouTube Studio" from the dropdown menu.

  3. A new page will appear.

  4. For each video:

    1. Click the "Upload video" button: 

    2. Drag the video file from your computer to the window that pops up.

    3. Give the video a title and description.

    4. Select an audience ("No, it's not made for kids")

    5. Click "More options" at the bottom of the window.

    6. For language, select the language of the subtitles.

    7. Right beneath this, click "Upload Subtitles/CC".

    8. Choose "With timing".

    9. Upload the .srt subtitle file corresponding to the video.

    10. Click Next twice.

    11. Select the appropriate Visibility.

    12. Click "Publish".

Adding Subtitles to a Video on CCLE (Kaltura)

You may wish to add subtitles to a video you will be uploading to CCLE. This process is unfortunately more complicated than adding them on YouTube. This is because CCLE requires subtitles to be in a format that Aegisub cannot create - .vtt.

Converting Subtitle Files from .srt to .vtt

We have a Python 3.8 script capable of converting .srt files to the .vtt format. This script is housed in the Humanities Technology Bitbucket and is publicly available at https://bitbucket.org/uclacdh/srt-to-vtt-subtitle-converter/src/master/. Running it requires Python to be installed on your computer and is best done on a Mac, so it is best for a RITC to complete this task.

To run this program:

  1. Put the srt_to_vtt.py file from Bitbucket in the same folder as the .srt file to convert.

  2. Change the line readFile = '0_6q1bx6ol.srt' to contain the name of the .srt file to convert

  3. Run in Python.

  4. The converted file will be in the same folder as the .srt file, with the same name, but with a .vtt extension.

Uploading .vtt Files to CCLE

First, you should upload the video to caption to CCLE.

  1. Turn editing mode on.

  2. Click the orange Add an activity or resource button at the bottom of the page.

  3. Select “Label” from the sidebar on the left. Other activity and resource types are also possible, but label is the easiest.

  4. Click the Add button.

  5. A new window will appear.

  6. In the “Label text” textbox, select the “Insert or edit an audio/video file” button, circled in red below:

  7. A new window will appear, labeled “Insert Media.”

  8. Click the “Video” tab.

  9. Click the Browse repositories… button.

  10. Follow the instructions to upload a file. The upload may take some time.

  11. Once the file is uploaded, click the Select this file button.

You are now ready to add the subtitles.

  1. In the “Insert Media” window, click the words “Subtitles and captions.”

  2. Under “Subtitle track URL,” click the Browse repositories… button.

  3. Upload your .vtt subtitle file.

  4. Select the language of the subtitles.

  5. Check the “Default” checkbox, if you would like these to play by default.

  6. Click Insert media.

  7. Click Save and continue to course.

You can now watch your video on your course site to ensure the subtitles have correctly uploaded.