add a readme

pull/1/head
Ondřej Hruška 5 years ago
parent f520c535b6
commit 4a808017e4
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 1
      .gitignore
  2. 60
      README.md
  3. 27
      test/sample.srt

1
.gitignore vendored

@ -1,4 +1,3 @@
/target
**/*.rs.bk
.idea/
*.srt

@ -0,0 +1,60 @@
# srtune 0.2.0
'srtune' helps you edit a .srt file to match a video. Input and output can be either a file, or a stream, so you can
pipe multiple invocations to create more complex operations. However, a single invocation should suffice in most cases.
An example invocation, used to adapt a full-length subtitle track to a shorter version of "Whisper of the Heart", looks
like this:
```
srtune source.srt -o whisper.srt -M235=15:06.7 -M309=24:15 -M412=32:12 \
-M411=32:01 -M762=58:51 -M895=1:08:33 -M1125=1:26:28 -M01:44:22=01:41:37.3
```
Times are specified with colons (required) and always include seconds (HH:MM:SS, MM:SS, 0:SS, :SS). Decimal point in the
seconds part, if needed, can be either a period or a comma; times can be copied from the .srt file. Numbers without
colons are assumed to be subtitle indices.
The tool can be used iteratively, adjusting the invocation until the generated subtitle file matches the audio track.
You can reload the file in VLC by dragging it onto the player window. To make this work, subtitle times specified in
arguments are the ones seen in the output file (after shifts and moving), while entry indices are those from the input
file.
Using indices makes it easier to specify a subtitle to alter, but it is tied to the one .srt file. Times are harder to
write, but the one configuration will work for any locatization or variant of the file,so long as it is intended for the
same version of the movie. Enable debug logging with '-v' to see times you can use in place of indices.
Indices are normally not renumbered, so the output file can be used as a reference for both times and indices when you
work out the right set of arguments. The flag '--renumber' will give each output entry a new sequential number. Please
note that, once renumbered, the indices in the output file should no longer be used in the command invocation, as there
can be (and often will be) differences from the original file.
```
USAGE:
srtune [FLAGS] [OPTIONS] [--] [INFILE]
FLAGS:
-h, --help Prints help information
-r, --renumber Renumber all emitted entries with sequential 1-based numbers.
-v Increase the logging verbosity; can be used multiple times
-V, --version Prints version information
OPTIONS:
-M, --automove <ENTRY=VIDEOTIME>... Move subtitles starting at a given time or index to align with a matching
audio track time. This argument can be given multiple times. Some subtitles
may be dropped if they fall outside the timeline after the move.
-S, --autoscale <SUBTIME=VIDEOTIME> Calculate scaling based on a perceived difference. The scaling is related to
the first emitted subtitle; align it with '--move'. This overrides '--scale'.
-d, --durscale <RATIO> Scale durations, can be combined with '--scale' or '--autoscale'. The given
value will always be multiplied by the absolute time scale. 1 means identity,
1.1 makes all times 10% longer.
-m, --move <OFFSET> Move all subtitles in time (e.g 12:00.15 or -0:44)
-o, --output <OUTFILE> Output file, defaults to stdout
-s, --scale <RATIO> Scale all subtitle times and durations to compensate for bitrate differences.
1 means identity, 1.1 makes all times 10% longer. Scaling is relative to the
first emitted subtitle; align it with '--move'. This option has no effect if
'--autoscale' is used.
ARGS:
<INFILE> Input file, leave out for stdin
```

@ -0,0 +1,27 @@
20
00:00:12,838 --> 00:00:20,762
♪♪~ Country Roads take me home
21
00:00:20,762 --> 00:00:28,770
♪♪~ To the place  belong
22
00:00:28,770 --> 00:00:32,758
♪♪~ West Virginia
23
00:00:32,758 --> 00:00:36,812
♪♪~ mountain momma
24
00:00:36,812 --> 00:00:40,766
♪♪~ Take me home
25
00:00:40,766 --> 00:00:46,772
♪♪~ Country Roads
26
00:00:46,772 --> 00:00:49,775
♪♪~
Loading…
Cancel
Save