SUBS(1p)
β¨ SUBS(1p) β like, the subtitle glow-up tool β¨
okay bestie, gather round π this is subs(1p), a page from the User Contributed Perl Documentation collection, and it is literally the main character of subtitle wrangling. it converts, joins, splits, and re-times subtitles. that's the whole vibe. no cap.
π FORMAT π
so here's how you call it, and yes the brackets are real:
subs [options] subfile [ subfile ... ]
you can hand it one subfile, or a whole little squad of subfiles. it's flexible like that. π
πΈ OPTIONS πΈ
every single one, no skips, periodt:
-a coeff,-b timeβ these two are theaandbcoefficients in the linear transformationu=at+b, wheretanduare the src and dest times. the default (identity transform, i.e. "leave my timeline alone") is[a=1,b=0]. cute lil detail:-acan also be set as a ratio, f.ex.23.9/25. slay.-c codecβ use codec to write the file. wanna know which codecs you actually have installed? runsubs -hand it'll spill the whole list. π₯-dβ tries to prolong the duration of text that disappears too fast. and "quickly" here means less than 0.8 second per line of text. so if your subs are out here blinking like a strobe light, this is your girl.-e commandβ runs perl code for each line of text in the file. on every run, the text and time variables get initialized, and any new values get written back to the file. the variables are:$_β subtitle text line$bβ cue beginning$eβ cue end$iβ line number$nβ number of lines%pβ persistent data between runs
and yes, you can specify -e several times. stack them. go feral. π§
-hβ Display help. (hi, hello, help)-iβ Edit files in place, and it makes a backup in.bakfiles. iconic, but pls read the warning later π-j secβ Time interval between joins, in seconds. default is2.-o fileβ the File to save processed subtitles to. default isout.sub.-Oβ Separate overlapped lines. untangle that mess, bestie.-p t1 t2or-P t2 t1β Set a control point, wheret1is the time a phrase is spoken in the film andt2is the time when that same phrase appears in the subtitle. you need two points to deduce the-aand-bcoefficients; if you only give one point, it just assumes the other one is[0,0].
times can be relative, f.ex. -p 01:00 +3.5 -p -20 1:00:00
and here's the tea on -P vs -p: they're the same except the argument sequence is reversed. -P exists for when you typed the arguments to -p manually and in the wrong order. we've all been there. π
-q t1 t2β Restrict changes, if any, to the time spant1-t2. the wordendcan be used as an alias to the end of the file. default values are0andend.-r rateβ Force frame-per-second rate for frame-based subs.-s timeβ Split in two parts by time.-vβ Be verbose. spill everything. main character energy. π-z file.subβ Zip subtitle files, so that the time information is read fromfile.sub, while the text information is read from the input file(s). lil franken-sub. π
π¦ NOTES π¦
the time format is either [[HH:]MM:]SS[.MSEC] or whatever is subtitle format-specific. iykyk.
π EXAMPLES π
Warning: -i is a great feature, but use it with certain caution. like, great feature, but she bites. π«Ά
if subtitles are shown too early (by 5 seconds):
subs -i -b 5 file.sub
if subtitles are for a movie in 25 fps, but need to be for 24 (only actually matters for frame-based formats):
subs -i -a 24/25 file.sub
if subtitles start ok, but after 1 hour are late by 7 seconds:
subs -i -p 0 0 -p 1:00:00 +7 file.sub
join two parts with a 15-second gap:
subs -o joined.sub -j 15 part1.sub part2.sub
split in two after 50 minutes and half a second (this makes basename.1.sub and basename.2.sub):
subs -o basename.sub -s 50:00.5 toobig.sub
remove closed caption-specific comments such as '[Sneezing]' or '[Music playing]':
subs -e 's/[\s-]*\[.*\]\s*\n*//gs' sub.sub
π BUGS π
subtitles written as ".smi" format may differ from the original. not a vibe, but forewarned is forearmed.
β SEE ALSO β
Subtitlesβ the backend module for this program
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org>.
and that's the whole page, bestie β¨ this one's from perl v5.34.0, dated 2022-06-17 β go forth and subtitle responsibly ππ
π¦ where this page comes from
- debian bookworm: libsubtitles-perl 1.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsubtitles-perl 1.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsubtitles-perl 1.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsubtitles-perl 1.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsubtitles-perl 1.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms