libse 5.1.0

dotnet add package libse --version 5.1.0
                    
NuGet\Install-Package libse -Version 5.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="libse" Version="5.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="libse" Version="5.1.0" />
                    
Directory.Packages.props
<PackageReference Include="libse" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add libse --version 5.1.0
                    
#r "nuget: libse, 5.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package libse@5.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=libse&version=5.1.0
                    
Install as a Cake Addin
#tool nuget:?package=libse&version=5.1.0
                    
Install as a Cake Tool

libse

libse is the subtitle engine behind Subtitle Edit — a general-purpose .NET library for reading, writing, converting, and fixing subtitles.

  • 300+ subtitle formats: SubRip (.srt), Advanced SubStation Alpha (.ass), WebVTT (.vtt), SAMI, EBU STL, PAC, Cavena 890, Timed Text / TTML, DFXP, SCC, and many more
  • Image-based and container formats: Blu-ray SUP, VobSub (.sub/.idx), DVB subtitles in transport streams, Matroska (.mkv), MP4, MXF
  • Fixing and formatting: fix common errors, auto-break/unbreak lines, remove text for hearing impaired, remove interjections, merge/split lines, bridge gaps, beautify time codes
  • Detection: subtitle format auto-detection, text encoding detection, language auto-detection
  • Targets .NET Standard 2.1 and .NET 10, MIT licensed

Install

dotnet add package libse

Load a subtitle file

The format and text encoding are detected automatically:

var subtitle = Subtitle.Parse(fileName); // null if not a known subtitle format
var numberOfLines = subtitle.Paragraphs.Count;
var firstText = subtitle.Paragraphs.First().Text;
var firstStartMs = subtitle.Paragraphs.First().StartTime.TotalMilliseconds;
var formatName = subtitle.OriginalFormat.FriendlyName; // e.g. "SubRip (.srt)"

Save / convert a subtitle file

Every format can serialize a Subtitle via ToText, so converting is just loading with one format and saving with another:

File.WriteAllText("new.srt", new SubRip().ToText(subtitle, "untitled"));
File.WriteAllText("new.vtt", new WebVTT().ToText(subtitle, "untitled"));

All formats are available via SubtitleFormat.AllSubtitleFormats.

Common operations

// Shift all cues 1.5 seconds later
subtitle.AddTimeToAllParagraphs(TimeSpan.FromSeconds(1.5));

// Re-time frame-based cues after a frame rate change
subtitle.ChangeFrameRate(25.0, 23.976);

// Auto-break a long line into two balanced lines
var broken = Utilities.AutoBreakLine("This is a very long subtitle line that should be broken into two nicely balanced lines");

// Strip formatting
var plain = HtmlUtil.RemoveHtmlTags(text, alsoSsaTags: true);

// Detect the language of a subtitle
var languageCode = LanguageAutoDetect.AutoDetectGoogleLanguage(subtitle); // e.g. "en"

License

libse is licensed under the MIT License, so it is free to use for both personal and commercial software. You are free to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the library without any restrictions, as long as the original copyright notice and license are included.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on libse:

Repository Stars
jellyfin/jellyfin
The Free Software Media System - Server Backend & API
vesoapp/veso
Open source media server.
SubtitleEdit/plugins
Plugins for Subtitle Edit
Tentacule/PgsToSrt
PGS to Srt converter
Version Downloads Last Updated
5.1.0 81 7/29/2026
4.1.0-alpha8 481 11/26/2025
4.1.0-alpha7 399 10/22/2025
4.1.0-alpha6 361 9/21/2025
4.1.0-alpha5 320 8/20/2025
4.1.0-alpha4 245 8/19/2025
4.1.0-alpha3 234 8/19/2025
4.1.0-alpha2 343 7/6/2025
4.1.0-alpha1 420 4/20/2025
4.0.12 185,516 4/15/2025
4.0.10 25,286 12/22/2024
4.0.8 36,022 9/6/2024
4.0.7 9,919 7/23/2024
4.0.5 30,594 4/13/2024
3.6.13 88,368 5/14/2023
3.6.11 13,824 3/11/2023
3.6.10 15,069 12/26/2022
3.6.5 82,870 3/20/2022
3.6.4 17,164 12/3/2021
3.6.2 11,024 9/7/2021
Loading failed