srt-process(1)

SRT subtitle processing tool

Section 1 python3-srt bookworm source

Description

SRT-PROCESS

NAME

srt-process - SRT subtitle processing tool

DESCRIPTION

usage: srt process [-h] [--input FILE] [--output FILE] [--inplace]

[--no-strict] [--debug] [--ignore-parsing-errors] [--encoding ENCODING] -f FUNC [-m MODULE]

Process subtitle text content using arbitrary Python code.

options:

-h, --help

show this help message and exit

--input FILE, -i FILE

the file to process (default: stdin)

--output FILE, -o FILE

the file to write to (default: stdout)

--inplace, -p

modify file in place

--no-strict

allow blank lines in output, your media player may explode

--debug

enable debug logging

--ignore-parsing-errors, -c

try to keep going, even if there are parsing errors

--encoding ENCODING, -e ENCODING

the encoding to read/write files in (default: utf8)

-f FUNC, --func FUNC

a function to use to process lines

-m MODULE, --module MODULE

modules to import in the function context

examples:

Strip HTML-like symbols from a subtitle

$ srt process -m re -f ’lambda sub: re.sub("<[ˆ<]+?>", "", sub)’