This guide goes over how to create an SRT file for your video when you use text to speech software.
SRT file referes to "Subrip Subtitle", it's very easy to do for captioning video content. Here are step by step process:
Basic Understanding of SRT File Before Starting
SRT files are derived from the software SubRip, which “ripped” the extracted subtitles and associated timings from video content as a text file. The format is as follows:
hours:minutes:seconds, milliseconds --> hours:minutes:seconds, milliseconds
Every SRT file needs 4 components:
- Number of the caption frame in sequence
- Beginning and ending timecodes
- Caption
- Blank line indicating the start of a new caption sequence
Create Your Own SRT File Now (Easy Way)
Use software recommended to generate the SRT file for you by converting spoken words into text.
Manual Method (Hard way)
Text Editor
1. Open a new file in TextEdit(Mac) or Notpad (Windows)
2. Number the sequence to the beginning of the first caption sequence
3. Enter the beginning and ending timecode of where you want the caption to show:
Follow this format:
hours:minutes:seconds,milliseconds --> hours:minutes:seconds, milliseconds
Why this is so time consuming: You have to manually mark timestamp for the entire video to match all dialogue
4. Enter the caption in any language. Make sure to limit the caption to less than 32 characters with 2 lines per caption on the screen.
A good video should pace the viewer with the caption. Not too slow, not too fast.
5. Rinse and repeat
PHP SRT File Generator
This script is for a file that has one line of transcription per line. It also assumes that the transcription is in English and that the length of each line of transcription is equal to the length of time that it should be displayed in the video.
Copy this code to create your own SRT file generator
<?php
// Set the input and output file names
$inputFile = 'transcription.txt';
$outputFile = 'transcription.srt';
// Open the input file
$inputHandle = fopen($inputFile, 'r');
// Open the output file
$outputHandle = fopen($outputFile, 'w');
// Initialize the counter for the subtitle number
$subtitleNumber = 1;
// Initialize the start and end times
$startTime = '00:00:00,000';
$endTime = '00:00:00,000';
// Read the input file line by line
while (($line = fgets($inputHandle)) !== false) {
// Write the subtitle number to the output file
fwrite($outputHandle, $subtitleNumber . "\n");
// Increment the subtitle number
$subtitleNumber++;
// Set the start time to the current end time
$startTime = $endTime;
// Calculate the end time by adding the length of the line to the start time
$lineLength = strlen($line);
$endTime = strtotime("+{$lineLength} seconds", strtotime($startTime));
$endTime = date('H:i:s,000', $endTime);
// Write the start and end times to the output file
fwrite($outputHandle, "{$startTime} --> {$endTime}\n");
// Write the line of transcription to the output file
fwrite($outputHandle, $line);
}
// Close the input and output files
fclose($inputHandle);
fclose($outputHandle);
Upload SRT File
YouTube
Go to video manager > choose your video > create new subtitles or CC
Vimeo
Go to distribution menu in Vimeo and select subtitles. Pick the language and upload the SRT file or other caption formats.
Open Facebook Videos > edit video > add caption > hit save (super easy)
Premiere Pro
Go to file > import > upload the SRT file.
Make sure the SRT file is properly time to show the caption at the right time.
Go to setting and make sure Closed Captions are enabled, then go to settings.
The captions should appear on the timeline editor, and the editor can cut and move them around to synch the video.
Simply upload a video and select an SRT file to upload.
TikTok
Upload a video > click text button to add caption > match the timeline
TikTok doesn't really need SRT file. The captions are supposed to be punchy and short.