Skip to content

A command-line tool for converting text files into subtitle (.srt) format. It parses scripts or transcripts, splits them into sentences, and formats them into customizable subtitles for multimedia content

License

Notifications You must be signed in to change notification settings

teddante/SubtitleSplitter

Repository files navigation

SubtitleSplitter

SubtitleSplitter is a simple command-line tool written in C# that allows you to convert a plain text file into a series of subtitles in .srt format. It's designed to take a text file containing a script or transcript and break it into chunks that can be used as subtitles for video or audio content.

Features

  • Read a text file and split it into sentences.
  • Convert sentences into a subtitle file format.
  • Sensible defaults for timing and wrapping.
    • One sentence per caption
    • Duration = characters / 15 cps (average reading speed)
    • No gap between consecutive captions
    • Wrapped to max 2 lines at ~42 characters per line (no truncation)

Getting Started

Prerequisites

  • .NET 8 SDK

Installation

Clone the repository to your local machine using:

git clone https://github.com/yourusername/SubtitleSplitter.git

Navigate into the cloned repository:

cd SubtitleSplitter

Build the project using:

dotnet build

Usage

Run the tool with a single argument: the path to your input .txt file. It will generate both an .srt and an .fcpxml file in the same directory named <input>_subtitles.srt and <input>_subtitles.fcpxml.

# Windows
SubtitleSplitter.exe "path/to/your/file.txt"

# Cross-platform
dotnet run --project src/SubtitleSplitter -- "path/to/your/file.txt"

Behavior is fixed to simple defaults: one sentence per subtitle, average reading speed timing, zero inter-caption gap, and up to 2 lines at ~42 characters per line.

FCPXML export (for NLEs like DaVinci Resolve)

An FCPXML 1.8 timeline is written by default alongside the SRT. It places each subtitle as a "Basic Title" clip at the correct time span. Many editors (including DaVinci Resolve) can import this format.

Notes:

  • The FCPXML uses a 1080p30 sequence and Basic Title effect.
  • Output filenames follow <input>_subtitles.srt and <input>_subtitles.fcpxml.

Contributing

If you would like to contribute to the development of SubtitleSplitter, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A command-line tool for converting text files into subtitle (.srt) format. It parses scripts or transcripts, splits them into sentences, and formats them into customizable subtitles for multimedia content

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages