GithubHelp home page GithubHelp logo

merge-subtitles's Introduction

Subtitle Merge Script

This shell script merges two .ass subtitle files, aligning the timing of the second subtitle file to match the timing of the first one. It also adjusts the alignment of the subtitles to display them at the top of the screen.

Prerequisites

  • This script requires ffmpeg to be installed on your system.

Usage

./merge_subtitles.sh file1.ass file2.ass
  • file1.ass: The reference subtitle file.
  • file2.ass: The subtitle file to be merged and aligned with file1.ass.

Output

The merged subtitle file will be created with the name file2.merged.ass in the same directory as the script.

Details

  1. Checks if exactly two arguments are provided.
  2. Identifies the Alignment field in the subtitle files and modifies it to display subtitles at the top of the screen.
  3. Extracts the dialogues from both files.
  4. Determines the time difference between the start times of the two subtitle files.
  5. Adjusts the timing of the second subtitle file using ffmpeg.
  6. Merges the modified second file with the first file, adjusting the alignment and timing.
  7. Cleans up temporary files.

Note

  • This script assumes the subtitle files are in Advanced SubStation Alpha (.ass) format. You can convert subtitle files to the .ass format using ffmpeg. For example:
    ffmpeg -i input.srt output.ass
  • If ffmpeg is not available, the script will not be able to adjust the timing of the subtitles.

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.