Scroll to navigation

PYSUBS2(1) User Commands PYSUBS2(1)

NAME

pysubs2 - command-line tool to convert and retime subtitle files

DESCRIPTION

usage: pysubs2 [-h] [-v] [-f {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}]

[-t {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}] [--input-enc ENCODING] [--output-enc ENCODING] [--enc-error-handling {strict,surrogateescape}] [--fps FPS] [-o DIR] [--clean] [--verbose] [--shift TIME | --shift-back TIME | --transform-framerate FPS1 FPS2] [--srt-keep-unknown-html-tags] [--srt-keep-html-tags] [--srt-keep-ssa-tags] [--sub-no-write-fps-declaration] [FILE ...]

The pysubs2 CLI for processing subtitle files. https://github.com/tkarabela/pysubs2

positional arguments:

Input subtitle files. Can be in SubStation Alpha (*.ass, *.ssa), SubRip (*.srt), MicroDVD (*.sub) or other supported format. When no files are specified, pysubs2 will work as a pipe, reading from standard input and writing to standard output.

options:

show this help message and exit
show program's version number and exit
By default, subtitle format is detected from the file. This option can be used to skip autodetection and force specific format. Generally, it should never be needed.
Convert subtitle files to given format. By default, each file is saved in its original format.
Character encoding for input files. By default, UTF-8 is used for both input and output.
Character encoding for output files. By default, it is the same as input encoding. If you wish to convert between encodings, make sure --input-enc is set correctly! Otherwise, your output files will probably be corrupted. It's a good idea to back up your files or use the -o option.
Character encoding error handling for input and output. Defaults to 'surrogateescape' which passes through unrecognized characters to output unchanged. Use 'strict' if you want the command to fail when encountering a character incompatible with selected input/output encoding.
This argument specifies framerate for MicroDVD files. By default, framerate is detected from the file. Use this when framerate specification is missing or to force different framerate.
Use this to save all files to given directory. By default, every file is saved to its parent directory, ie. unless it's being saved in different subtitle format (and thus with different file extension), it overwrites the original file.
Attempt to remove non-essential subtitles (eg. karaoke, SSA drawing tags), strip styling information when saving to non-SSA formats
Print misc logging
Delay all subtitles by given time amount. Time is specified like this: '1m30s', '0.5s', ...
The opposite of --shift (subtitles will appear sooner).
Multiply all timestamps by FPS1/FPS2 ratio.

optional arguments (SRT):

(input) do not strip unrecognized HTML tags
(input) do not convert HTML tags to SubStation internally, this implies --srt-keep-unknown-html-tags
(output) do not convert/strip SubStation tags for output

optional arguments (MicroDVD):

(output) omit writing FPS as first zero-length subtitle

usage examples:

python -m pysubs2 --to srt *.ass python -m pysubs2 --to srt --clean *.ass python -m pysubs2 --to microdvd --fps 23.976 *.ass python -m pysubs2 --shift 0.3s *.srt python -m pysubs2 --shift 0.3s <my_file.srt >retimed_file.srt python -m pysubs2 --shift-back 0.3s --output-dir retimed *.srt python -m pysubs2 --transform-framerate 25 23.976 *.srt

SEE ALSO

The full documentation for pysubs2 is maintained as a Texinfo manual. If the info and pysubs2 programs are properly installed at your site, the command

info pysubs2

should give you access to the complete manual.

June 2024 pysubs2 1.7.1