Giter VIP home page Giter VIP logo

sub-sync's Introduction

sub-sync

Enables a fixed setting of subtitle time offsets to a selected SubRip (srt) file via the CLI by overwriting its time intervals.

It differs from utilizing subtitle shifts inside an arbitrary media player, due to permenently applying timeline changes, not just during an active session โ€” sync audio and subtitle tracks once, use them multiple times.

Install

Fetch the latest version:

python3 -m pip install git+https://github.com/tainn/[email protected]

Usage

A negative offset value hastens, while a positive offset value delays the subtitles.

The script can be executed via the CLI with or without a -p or --path parameter. If omitting the use, the code will look for a srt file in the current working directory and exit if none or more than one match is found. An exception to this case are srt files that abide by a glob match: *old-[0-9][0-9].srt. This is done in order to allow rapid readjustments (up to 100 times) when attempting to set an audio-subtitle sync via trial and error โ€” see output.

$ subsync --help
usage: subsync [-h] [-p PATH] offset

positional arguments:
  offset                amount of seconds to shift (+-0.000)

options:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  absolute or relative path to the file

Output

The output is a new srt file with newly set timelines, with the old file being kept and renamed to -old-{incr}.srt, where {incr} is a serial increment of old srt files in the same directory, starting with 00 and ending with 99, allowing for up to 100 buffered files.

Bad forms

The SubRip (srt) files usually follow their file format. This code assumes that to be the form of the passed file and may error out if the form is different. Even though it rarely happens, the culprit for such mismatches is usually a type of bad-form advertising of a subtitle group at the top of the file. Either manually delete that segment or change it to fit the format.

sub-sync's People

Contributors

tainn avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.