File: pysubs2.1

package info (click to toggle)
python-pysubs2 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,840 kB
  • sloc: python: 4,016; makefile: 163
file content (133 lines) | stat: -rw-r--r-- 4,760 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.49.3.
.TH PYSUBS2 "1" "June 2024" "pysubs2 1.7.1" "User Commands"
.SH NAME
pysubs2 \- command-line tool to convert and retime subtitle files
.SH DESCRIPTION
usage: pysubs2 [\-h] [\-v] [\-f {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}]
.IP
[\-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 | \fB\-\-shift\-back\fR TIME | \fB\-\-transform\-framerate\fR FPS1 FPS2]
[\-\-srt\-keep\-unknown\-html\-tags] [\-\-srt\-keep\-html\-tags]
[\-\-srt\-keep\-ssa\-tags] [\-\-sub\-no\-write\-fps\-declaration]
[FILE ...]
.PP
The pysubs2 CLI for processing subtitle files.
https://github.com/tkarabela/pysubs2
.SS "positional arguments:"
.TP
FILE
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.
.SS "options:"
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-v\fR, \fB\-\-version\fR
show program's version number and exit
.TP
\fB\-f\fR {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}, \fB\-\-from\fR {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}
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.
.TP
\fB\-t\fR {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}, \fB\-\-to\fR {srt,ass,ssa,microdvd,json,mpl2,tmp,vtt}
Convert subtitle files to given format. By default,
each file is saved in its original format.
.TP
\fB\-\-input\-enc\fR ENCODING
Character encoding for input files. By default, UTF\-8
is used for both input and output.
.TP
\fB\-\-output\-enc\fR ENCODING
Character encoding for output files. By default, it is
the same as input encoding. If you wish to convert
between encodings, make sure \fB\-\-input\-enc\fR is set
correctly! Otherwise, your output files will probably
be corrupted. It's a good idea to back up your files
or use the \fB\-o\fR option.
.TP
\fB\-\-enc\-error\-handling\fR {strict,surrogateescape}
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.
.TP
\fB\-\-fps\fR FPS
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.
.TP
\fB\-o\fR DIR, \fB\-\-output\-dir\fR DIR
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.
.TP
\fB\-\-clean\fR
Attempt to remove non\-essential subtitles (eg.
karaoke, SSA drawing tags), strip styling information
when saving to non\-SSA formats
.TP
\fB\-\-verbose\fR
Print misc logging
.TP
\fB\-\-shift\fR TIME
Delay all subtitles by given time amount. Time is
specified like this: '1m30s', '0.5s', ...
.TP
\fB\-\-shift\-back\fR TIME
The opposite of \fB\-\-shift\fR (subtitles will appear
sooner).
.TP
\fB\-\-transform\-framerate\fR FPS1 FPS2
Multiply all timestamps by FPS1/FPS2 ratio.
.SS "optional arguments (SRT):"
.TP
\fB\-\-srt\-keep\-unknown\-html\-tags\fR
(input) do not strip unrecognized HTML tags
.TP
\fB\-\-srt\-keep\-html\-tags\fR
(input) do not convert HTML tags to SubStation
internally, this implies \fB\-\-srt\-keep\-unknown\-html\-tags\fR
.TP
\fB\-\-srt\-keep\-ssa\-tags\fR
(output) do not convert/strip SubStation tags for
output
.SS "optional arguments (MicroDVD):"
.TP
\fB\-\-sub\-no\-write\-fps\-declaration\fR
(output) omit writing FPS as first zero\-length
subtitle
.SS "usage examples:"
.IP
python \fB\-m\fR pysubs2 \fB\-\-to\fR srt *.ass
python \fB\-m\fR pysubs2 \fB\-\-to\fR srt \fB\-\-clean\fR *.ass
python \fB\-m\fR pysubs2 \fB\-\-to\fR microdvd \fB\-\-fps\fR 23.976 *.ass
python \fB\-m\fR pysubs2 \fB\-\-shift\fR 0.3s *.srt
python \fB\-m\fR pysubs2 \fB\-\-shift\fR 0.3s <my_file.srt >retimed_file.srt
python \fB\-m\fR pysubs2 \fB\-\-shift\-back\fR 0.3s \fB\-\-output\-dir\fR retimed *.srt
python \fB\-m\fR pysubs2 \fB\-\-transform\-framerate\fR 25 23.976 *.srt
.SH "SEE ALSO"
The full documentation for
.B pysubs2
is maintained as a Texinfo manual.  If the
.B info
and
.B pysubs2
programs are properly installed at your site, the command
.IP
.B info pysubs2
.PP
should give you access to the complete manual.