A simple, fast and efficient command-line program written in C to edit SRT files
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-03-18 11:38:26 +02:00
.gitattributes Initial commit 2026-02-15 16:28:06 +02:00
.gitignore Fixes 2026-02-15 16:30:45 +02:00
LICENSE Initial commit 2026-02-15 16:28:06 +02:00
main.c Backups, windows compatability 2026-02-15 18:17:28 +02:00
README.md Update README.md 2026-03-18 11:38:26 +02:00

Codrut-Subtitle-Editor

A simple, fast and efficient command-line program written in C to edit SRT files

Supports copying, removing, offsetting, and progressive (linear) time shifting of subtitles with flexible time parsing.


Features

  • Read and write standard .srt files
  • Multiple time input formats:
    • hh:mm
    • hh:mm:ss
    • hh:mm:ss,ms
    • 12.5s, 3m, 1.2h
  • Offset subtitles by fixed time
  • Linear progressive offset
  • Remove subtitle ranges
  • Optional index rebuild
  • Optional chronological sorting (--fix-order)
  • Blazing fast with no dependencies (pure C, standard library)

Compilation / Installation

Linux / macOS:

gcc -O2 -Wall -o srt-edit main.c
sudo mv srt-edit /usr/bin 

Usage

srt-edit [options]

Command Reference

Category Name Option / Mode Description
Information Help --help, -h Display help information and commands
Information Usage --usage Display commands and examples
Information Version --version, -v Show version information
Information Verbose --verbose Show verbose info
Input / Output Input File -i, --in File to read from (Required)
Input / Output Output File -o, --out File to write to (Defaults to input file)
Input / Output Yes -y, --yes Do not ask for confirmations
Operation Mode Copy (Default) -oc, --operation-copy Copy subtitle to destination
Operation Mode Remove Range -or, --operation-remove Remove subtitle range
Operation Mode Fixed Offset -oo, --operation-offset Offset subtitles in range
Operation Mode Linear Offset -olo, --operation-linear-offset Offset range linearly based on time value
Data Parameters Fixed Offset Value --offset Time value for fixed offset mode
Data Parameters Linear Offset Start --offset-from Starting offset for linear mode
Data Parameters Linear Offset End --offset-to Ending offset for linear mode
Range Options From Time --from Start range from specific time
Range Options To Time --to End range at specific time
Range Options From Index --from-index Start range from subtitle index
Range Options To Index --to-index End range at subtitle index
Range Options Full Range --range-full Apply operation to entire file
Output Options No Rebuild Index -nix, --no-rebuild-index Do not re-build subtitle indices after modification
Output Options Fix Order --fix-order Sort data chronologically to conform to SRT standard

Examples

--verbose is not required, I added it in the examples so you can see the inner-workings of the program in more detail.

Basic Copy

srt-edit -i movie.srt -o out.srt

Remove First 20 Subtitles

srt-edit --verbose -i movie.srt -o out.srt -or --from-index 1 --to-index 20

Shift Entire File by 3.5 Seconds

srt-edit --verbose -i movie.srt -o out.srt -oo --offset 3.5s --range-full

Shift Everythinf after 15m by 3.5 Seconds

srt-edit --verbose -i movie.srt -o out.srt -oo --offset 3.5s --from 15m

When the end is not provided, the program will ask you if you'd like to select the destination as the end of the file. To skip the confirmation and select the end without a prompt, provide --yes.

Output

image

Progressive Sync Adjustment

srt-edit --verbose -i movie.srt -o out.srt -olo --offset-from -2s   --offset-to 4s   --from-index 1   --to-index 500

Time Format Interpreter

Accepted formats:

hh:mm
hh:mm:ss
hh:mm:ss,ms
X.Xs
X.Xm
X.Xh

Examples:

12.5s
1.2m
00:10:35,500