Giter Club home page Giter Club logo

supmover's Introduction

SupMover

SupMover - Shift timings and Screen Area of PGS/Sup subtitle

Usage

Usage:  SupMover <input.sup> [<output.sup>] [OPTIONS ...]

OPTIONS:
  --trace
  --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 (<num>/<den> | <fps>) | timestamp)
  --fixmode (cut | (delete | del))

Options

  • --trace
    • Print contents and structure of input file segments
  • --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
    • Multiply all the timestamp by this factor, this can also be supplied as a fraction
  • --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 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
    • 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
    • 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
    • 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. 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

g++.exe -Wall -fexceptions -O2 -Wall -Wextra  -c main.cpp -o main.o
g++.exe -o SupMover.exe main.o -s -static

supmover's People

Contributors

hannesbraun avatar jduncanator avatar mblythe86 avatar monos avatar yourmjk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

supmover's Issues

`cut_merge` broken

You mentioned that the cut_merge mode is broken and shouldn't be used.
What is broken? I want to use it.

Error parsing cutMerge list

When I try to run it with the command
SupMover 01.sup 01_edit.sup add_zero cut_merge list "[1-2182] [2182-30048] [37265-51086] [51088-51207] [51210-71970] [71969-77015] [76999-77759]" format secut timemode frame 23.976 fixmode cut

it throws an "Error parsing input" error.
The cropping etc. functions work fine, so it's possible I'm interpreting how the cut_merge syntax is supposed to be written out; if so I'd appreciate help on how I'm supposed to write it.

Cropping without shifting the subtitles

Thanks for this wonderful tool.

Could you perhaps add an option to crop without shifting the images? I removed black letterbox bars from a video, and I want to do the same for the subtitles. In picture:

image worth thousand words

I have a feeling removing the subtraction from line 395 would do it, but as I'm not experienced with C++ nor do I have the necessary environment to build and compile myself, I thought I'd just ask.

关于tonemap功能的使用

请问这个功能调整的亮度,1表示100%亮度,1.2表示120%亮度,0.8表示80%亮度,是这么个意思么?
另外此功能是否会改变图片显示质量?

Bug in crop mode?

If I understand the code right then the same i, which is actually the index of the wds.windows being iterated, is also used here to index pcs.compositionObject:

SupMover/main.cpp

Lines 973 to 980 in 9646a10

if (corrVer != 0) {
pcs.compositionObject[i].objectVerPos -= corrVer;
fixPCS = true;
}
if (corrHor != 0) {
pcs.compositionObject[i].objectHorPos -= corrHor;
fixPCS = true;
}

I don't know much about the PGS spec but this can't be right?

This should only work if a Display Set contains exactly one composition object/image per window (spec says can also be two) and their order is the same (not sure if that's guaranteed).
Besides that, my example .sup files have Display Sets with pcs.numCompositionObject == 0 but wds.numberOfWindows > 0, so uninitialized t_compositionObjects are being manipulated in that case.

I supposed it should be something like this instead:

if (corrVer != 0 || corrHor != 0) {
    for (int j = 0; j < pcs.numCompositionObject; j++) {
        if (pcs.compositionObject[j].windowID != wds.windows[i].windowID) continue;
        pcs.compositionObject[j].objectVerPos -= corrVer;
        pcs.compositionObject[j].objectHorPos -= corrHor;
    }
    fixPCS = true;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.