ChapterTool.Core 23.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ChapterTool.Core --version 23.0.0
                    
NuGet\Install-Package ChapterTool.Core -Version 23.0.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="ChapterTool.Core" Version="23.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ChapterTool.Core" Version="23.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ChapterTool.Core" />
                    
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 ChapterTool.Core --version 23.0.0
                    
#r "nuget: ChapterTool.Core, 23.0.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 ChapterTool.Core@23.0.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=ChapterTool.Core&version=23.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ChapterTool.Core&version=23.0.0
                    
Install as a Cake Tool

ChapterTool.Core

A .NET library for parsing, editing, and exporting multimedia chapter files. Supports 12 import formats and 10 export formats.

Installation

dotnet add package ChapterTool.Core

Features

  • Import chapters from 12 formats: CUE, FLAC, TAK, IFO, MPLS, XPL, MP4, OGM, Matroska XML, WebVTT, plain text, Premiere markers
  • Export chapters to 10 formats: OGM Text, Matroska XML, QPFile, TimeCodes, tsMuxeR Meta, CUE, JSON, WebVTT, Celltimes, Chapter→QPFile
  • Edit chapter data: time edit, frame edit, rename, delete, insert, reorder, shift, apply name templates
  • Transform chapter times: infix math expression engine, Lua scripting engine, frame rate detection and conversion
  • Combine & append chapter segments from multi-part sources (MPLS/DVD)

Quick Start

Import Chapters

using ChapterTool.Core.Importing;
using ChapterTool.Core.Models;
using ChapterTool.Core.Transform;

var formatter = new ChapterTimeFormatter();

// CUE files don't require extra dependencies
IChapterImporter importer = new CueChapterImporter();
var request = new ChapterImportRequest("/path/to/chapters.cue");
var result = await importer.ImportAsync(request, CancellationToken.None);

if (result.Success)
{
    foreach (var group in result.Groups)
    {
        Console.WriteLine($"Source: {group.SourcePath}");
        foreach (var option in group.Options)
        {
            Console.WriteLine($"  {option.DisplayName}: {option.ChapterInfo.Chapters.Count} chapters");
        }
    }
}

Export Chapters

using ChapterTool.Core.Exporting;
using ChapterTool.Core.Transform;

var formatter = new ChapterTimeFormatter();
var exportService = new ChapterExportService(formatter);

var options = new ChapterExportOptions(
    Format: ChapterExportFormat.Xml,
    XmlLanguage: "eng"
);

var result = exportService.Export(chapterInfo, options);
if (result.Success)
{
    File.WriteAllText($"output{result.FileExtension}", result.Content);
}

Edit Chapters

using ChapterTool.Core.Editing;

var editor = new ChapterEditingService(new ChapterTimeFormatter());

// Rename a chapter
var result = editor.Rename(info, index: 0, name: "Opening");

// Edit chapter time
result = editor.EditTime(info, index: 0, text: "00:05:30.000");

// Delete chapters
result = editor.Delete(info, indexes: new HashSet<int> { 2, 3 });

// Apply name template (one name per line)
result = editor.ApplyTemplate(info, "Opening\nMain Feature\nCredits");

Transform Chapter Times

using ChapterTool.Core.Transform;

// Frame rate detection
var fpsService = new FrameRateService();
var detected = fpsService.Detect(info, tolerance: 0.001m);

// Change frame rate
var fpsResult = ChapterFpsTransformService.ChangeFps(info, sourceFps: 23.976m, targetFps: 25m);

// Evaluate a mathematical expression against chapter times
var exprService = new ExpressionService();
var eval = exprService.EvaluateInfix("t + 1.0", timeSeconds: 60m, framesPerSecond: 23.976m);

// Use Lua scripting for advanced transforms
var luaService = new LuaExpressionScriptService();
var context = new LuaExpressionContext(chapter, index: 1, count: 10, timeSeconds: 60m, framesPerSecond: 23.976m);
var luaResult = luaService.Evaluate("return t + 1", context);

Supported Formats

Import

Format Importer Extensions
CUE Sheet CueChapterImporter .cue
FLAC CUE FlacCueImporter .flac
TAK CUE TakCueImporter .tak
DVD IFO IfoChapterImporter .ifo
Blu-ray MPLS MplsChapterImporter .mpls
Blu-ray XPL XplChapterImporter .xpl
MP4 / M4V Mp4ChapterImporter .mp4, .m4v
Media files MediaChapterImporter via IMediaChapterReader
OGM Text OgmChapterImporter .txt
Matroska XML XmlChapterImporter .xml
WebVTT WebVttChapterImporter .vtt
Plain Text TextChapterImporter .txt
Premiere Markers PremiereMarkerListImporter .csv

Export

Format ChapterExportFormat
OGM Text Txt
Matroska XML Xml
QPFile Qpfile
TimeCodes TimeCodes
tsMuxeR Meta TsMuxerMeta
CUE Sheet Cue
JSON Json
WebVTT WebVtt
Celltimes Celltimes
Chapter → QPFile Chapter2Qpfile

Expression Engine

ExpressionService supports infix mathematical expressions with:

  • Variables: t (time in seconds), fps (frames per second)
  • Operators: +, -, *, /, %, ^, >, <, >=, <=, ternary ?:
  • Functions: abs, acos, asin, atan, atan2, cos, sin, tan, cosh, sinh, tanh, exp, log, log10, sqrt, ceil, floor, round, int, sign, pow, max, min
  • Constants: M_E, M_PI, M_LN2, M_LN10, M_SQRT2, etc.

For advanced transforms, LuaExpressionScriptService provides full Lua scripting with access to chapter properties (t, fps, index, count) and the math standard library. Built-in presets include identity, time offset, frame rounding, and half-frame shift.

Diagnostic System

All operations return diagnostics via ChapterDiagnostic:

public sealed record ChapterDiagnostic(
    DiagnosticSeverity Severity,  // Info, Warning, Error
    string Code,
    string Message,
    string? Location = null,
    string? Details = null,
    IReadOnlyDictionary<string, object?>? Arguments = null);

Extensibility

Implement IChapterImporter to add custom chapter import formats:

public interface IChapterImporter
{
    string Id { get; }
    IReadOnlySet<string> SupportedExtensions { get; }
    ValueTask<ChapterImportResult> ImportAsync(ChapterImportRequest request, CancellationToken cancellationToken);
}

Implement IChapterExporter to add custom export formats, or IMediaChapterReader to support reading chapters from additional media container formats.

License

GPL-3.0

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
23.3.1 81 8/13/2026
23.3.0 173 7/30/2026
23.2.1 105 7/22/2026
23.2.0 102 7/18/2026
23.1.0 121 7/9/2026
23.0.0 108 7/8/2026