Import sample.srt from the download. ToTranscript() keeps the cue times without audio or a model.
dotnet add package RecursiveAI.OneSpeech.MediaRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using OneSpeech.Media; using RecursiveAI.OneMedia.Captions; var bytes = File.ReadAllBytes("sample.srt"); var cues = SubtitleFormats.Srt.Read(bytes); var transcript = cues.ToTranscript(); Console.WriteLine(transcript.Text);
Unzip the example, then dotnet run.
Welcome to the workshop. Let’s get started.
The RecursiveAI.OneSpeech.Media package brings in RecursiveAI.OneMedia.Captions through its OneMedia dependency.
The full program
Here’s the complete sample.srt. Each cue has a number, a time range and the text to display.
1 00:00:01,000 --> 00:00:03,500 Welcome to the workshop. 2 00:00:04,000 --> 00:00:06,000 Let’s get started.
using OneSpeech.Media; using RecursiveAI.OneMedia.Captions; var bytes = File.ReadAllBytes("sample.srt"); var cues = SubtitleFormats.Srt.Read(bytes); var transcript = cues.ToTranscript(); Console.WriteLine(transcript.Text); foreach (var segment in transcript.Segments) { Console.WriteLine($"{segment.Start:c} --> {segment.End:c}"); } Console.WriteLine($"Word records: {transcript.Words.Length}"); Console.WriteLine($"Speaker turns: {transcript.Turns.Length}");
dotnet run prints:
Welcome to the workshop. Let’s get started. 00:00:01 --> 00:00:03.5000000 00:00:04 --> 00:00:06 Word records: 0 Speaker turns: 0
The SRT reader can throw MediaFormatException if it can’t read the input as that format.
Variations
Save plain text. Replace the last line of the snippet at the top. This writes the two text lines to transcript.txt, without the cue numbers or time ranges.
File.WriteAllText("transcript.txt", transcript.Text);Related recipes
The short answer
In C#, pass the bytes of the .srt file to SubtitleFormats.Srt.Read, then call ToTranscript() on the result. The parser is available through the RecursiveAI.OneSpeech.Media package. Use transcript.Text for the joined subtitle text or transcript.Segments when you also need the start and end of each cue. This imports existing captions; it doesn’t run speech recognition or check the captions against the recording.
What is the SRT subtitle format?
SubRip (SRT) is a text format for subtitles. A blank line separates cue blocks; a single block can have more than one line of text. In 00:00:03,500, the comma separates whole seconds from milliseconds. That timestamp marks an edge of the display window for the entire cue, not the moment an individual word is spoken.
The importer makes one segment per cue. In the example, the second segment starts at 4 seconds and ends at 6 seconds. The half-second gap between the two segments stays in the timestamps; it doesn’t become an extra segment or a blank line in transcript.Text.
How do you convert SRT to plain text without losing the timestamps you still need?
Write transcript.Text to a text file for reading or searching. The text joins the segment strings with newlines. It doesn’t include cue numbers or timestamp lines, and it doesn’t try to rewrite captions into paragraphs or remove repeated dialogue. Keep the original SRT if another tool still needs the subtitle file. If your application needs the OneSpeech segments and their timing later, the transcript JSON format stores the transcript data instead of flattening it to text.
A common shortcut is to delete every line that looks like a number. That can remove real subtitle text, such as a cue that reads “2026.” Reading the SRT as cues first separates the file structure from the content before you export the text.
Can you get word timestamps from an SRT file?
Not from the cue times alone. Nothing in the first cue tells you when “workshop” began. The OneSpeech caption guide puts it plainly: “It never infers word times from cue bounds.” The example has no word records and no speaker turns. A speaker’s name typed into an SRT cue is still text, not a separate speaker label.
Use the existing cue times if you only need to jump to the right passage in a recording. If you need where each word falls, you need another source of timing, such as aligning the supplied text to the original audio. That is a separate operation from importing subtitles.