CaptionConverter: turning any subtitle file into scrolling lyrics
Music players show scrolling lyrics from .lrc files — timestamped text like
[01:23.45]lyric line. Subtitles come in a dozen other formats. This project,
SrtToLrcConverterSimple-CSharp,
converts between them, available as both a WPF desktop app and a
command-line tool sharing one conversion core.
Eight input formats, auto-detected by content
SRT, WebVTT, SSA/ASS, SAMI, MicroDVD (frame-based, configurable FPS), MPL2, PJS and TTML/DFXP
(XML). The interesting decision: detection is by content, not file extension.
Extensions lie — a ".srt" may actually be VTT. Each format has a recognisable signature (SRT's
numeric counters, WebVTT's WEBVTT header, TTML's XML namespace), and the converter
sniffs before parsing. Batch mode walks a folder recursively, and one bad file is reported and
skipped instead of aborting the run.
The parsing lessons in here are transferable
- Timestamps are harder than they look.
00:01:02,500(SRT) vs00:01:02.500(VTT) vs deciseconds (MPL2) vs frames-at-FPS (MicroDVD) — a converter must normalise all of them to milliseconds before anything else. - Encoding matters. Files arrive as UTF-8, UTF-16 with BOM, or legacy ANSI; the tool auto-detects (BOM first, then UTF-8 validity, then ANSI fallback) and lets you pin an explicit encoding.
- Markup stripping is a pipeline.
<i>Hello</i>and ASS{\i1}overrides both become plainHello.
Project structure
One solution, two UIs, one core library. The WPF app adds drag-and-drop and progress; the CLI adds automation. Conversion logic lives in neither — it is the shared dependency, which is why both stay correct.
Repository: github.com/bobhuang1/SrtToLrcConverterSimple-CSharp