Skip to content

Commit

Permalink
Merge pull request #17 from YourMJK/prettier-usage
Browse files Browse the repository at this point in the history
Dash prefix for options & Prettier usage
  • Loading branch information
MonoS authored Feb 2, 2024
2 parents afc49b5 + 617f4e5 commit 442352d
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 61 deletions.
72 changes: 45 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,63 @@
SupMover - Shift timings and Screen Area of PGS/Sup subtitle

# Usage
`SupMover (<input.sup> <output.sup>) [delay (ms)] [move (<delta x> <delta y>)] [crop (<left> <top> <right> <bottom>)] [resync (<num>/<den> | multFactor)] [add_zero] [tonemap <perc>] [cut_merge <Cut&Merge option>]`
```
Usage: SupMover <input.sup> <output.sup> [OPTIONS ...]
OPTIONS:
--delay <ms>
--move <delta x> <delta y>
--crop <left> <top> <right> <bottom>
--resync (<num>/<den> | <multFactor>)
--add_zero
--tonemap <perc>
--cut_merge [CUT&MERGE OPTIONS ...]
CUT&MERGE OPTIONS:
--list <list of sections>
--format (secut | (vapoursynth | vs) | (avisynth | avs) | remap)
--timemode (ms | frame | timestamp)
--fixmode (cut | (delete | del))
```

`SupMover (<input.sup> <output.sup> <ms>)` old syntax, kept for backward compatibility
Old syntax, kept for backward compatibility:
`SupMover <input.sup> <output.sup> <ms>`

# Modes
* delay
# Options
* `--delay`
* Apply a milliseconds delay, positive or negative, to all the subpic of the subtitle, it can be fractional as the SUP speficication have a precision of 1/90ms
* resync
* `--resync`
* Multiply all the timestamp by this factor, this can also be supplied as a fraction
* move
* `--move`
* Shift the windows position of all subpic by the inputed parameters (the image data is left untouched).
* Position is clamped to the screen edges so that windows are always fully contained within the screen area.
* crop
* `--crop`
* Crop the windows area of all subpic by the inputed parameters.
* This is done losslessly by only shifting the windows position (the image data is left untouched).
* Crop functionality is not exstensivelly tested when multiple Composition Object or Windows are present or when the windows are is outside the new screen area, a warning is issued if that's the case and i strongly advise to check the resulting subtitle with a video player, also handling of the Object Cropped flag and windows area bigger than the new screen area is not implemented, a warning is issued if needed
* If both move and crop are selected, the crop is performed after the move.
* delay + resync
* If both modes are selected the delay will be adjusted if it comes before the resync parameter, for example if the program is launched with `delay 1000 resync 1.001` it will be internally adjusted to 1001ms, instead if it's launched with `resync 1.001 delay 1000` it will not
* add_zero
* If both `--move` and `--crop` are selected, the crop is performed after the move.
* `--delay` + `--resync`
* If both modes are selected the delay will be adjusted if it comes before the resync parameter, for example if the program is launched with `--delay 1000 --resync 1.001` it will be internally adjusted to 1001ms, instead if it's launched with `--resync 1.001 --delay 1000` it will not
* `--add_zero`
* Some media players (especially Plex) don't correctly sync `*.sup` subtitles. They seem to ignore any delay before the first 'display set'. This option adds a dummy 'display set' at time 0 so subsequent timestamps are correctly interpreted.
* tonemap
* `--tonemap`
* Change the brightness of the subtitle applying the specified percentage factor to all the palette's luminance value, similar to https://github.com/quietvoid/subtitle_tonemap , the percentage must be specified as a decimal value with 1 as 100%, it can be bigger than 1 to increase brightness
* cut_merge
* `--cut_merge`
* allows to cut subtitle and optionally, if more sections are specified, to merge the cuts into a single subtitle file with the subsequent cuts shifted to have them begin at the end of the previous section. It is possible to personalize its functionality with some options
* list: specifies the space-separated list of sections, `format` and `timemode` can be used to further configure the parsing of this list. The list must be contained inside double quotes
* format: the format type of the list
* secut: uses the same format as SECut. eg `1000-2000;3000-4000`
* vapoursynt or vs: uses the same format as vapoursynth split sintax, additionally if `timemode` is set as `frame` the range will be treated inclusively at the start and exclusively at the end. eg `[1000:2001] [3000:4001]`
* avisynth or avs: uses the same format as avisynth trim sintax. Eg `(1000,2000) (3000,4000)`
* remap: uses the same format as [Vapoursynth-RemapFrames ReplaceFrameSimple](https://github.com/Irrational-Encoding-Wizardry/Vapoursynth-RemapFrames#replaceframessimple). Eg `[1000 2000] [3000 4000]`
* timemode: allow to specifies how to read the values of the sections
* ms
* frame: if selected a framerate MUST be specified, as a fraction like `24000/1001` or as a number like `23.976`
* timestamp: if selected the sections MUST be in the format hh:mm:ss.ms and can't be used with `format vapoursynth`
* fixmode: allow to specify how to treat subtitles which are not fully contained in a section
* del or delete: delete the subtitle if not fully contained inside a section
* cut: cut the subtitle so that it is fully contained in the section
* if no further option is specified it will works like secut so like the following command line `format secut timemode ms fixmode delete`
* `--list`: specifies the space-separated list of sections, `--format` and `--timemode` can be used to further configure the parsing of this list. The list must be contained inside double quotes
* `--format`: the format type of the list
* `secut`: uses the same format as SECut. eg `1000-2000;3000-4000`
* `vapoursynt` or `vs`: uses the same format as vapoursynth split sintax, additionally if `--timemode` is set as `frame` the range will be treated inclusively at the start and exclusively at the end. eg `[1000:2001] [3000:4001]`
* `avisynth` or `avs`: uses the same format as avisynth trim sintax. Eg `(1000,2000) (3000,4000)`
* `remap`: uses the same format as [Vapoursynth-RemapFrames ReplaceFrameSimple](https://github.com/Irrational-Encoding-Wizardry/Vapoursynth-RemapFrames#replaceframessimple). Eg `[1000 2000] [3000 4000]`
* `--timemode`: allow to specifies how to read the values of the sections
* `ms`
* `frame`: if selected a framerate MUST be specified, as a fraction like `24000/1001` or as a number like `23.976`
* `timestamp`: if selected the sections MUST be in the format hh:mm:ss.ms and can't be used with `--format vapoursynth`
* `--fixmode`: allow to specify how to treat subtitles which are not fully contained in a section
* `delete` or `del`: delete the subtitle if not fully contained inside a section
* `cut`: cut the subtitle so that it is fully contained in the section
* if no further option is specified it will works like secut so like the following command line `--format secut --timemode ms --fixmode delete`


# Build instruction
Expand Down
Loading

0 comments on commit 442352d

Please sign in to comment.