SrtMerger is a tool to merge two or more subtitle (.srt) files together.
Project description
SrtMerger
A command-line tool to merge multiple SRT subtitle files with customizable colors, positions, and encodings.
Subtitle merger is a tool for merging two or more subtitles for videos. SRT Merger allows you to merge subtitle files, no matter what language are the subtitles encoded in. The result of this merge will be a new subtitle file which will display subtitles from each merged file.
Features
- Merge multiple SRT subtitle files into one
- Customize subtitle colors for each input file
- Set subtitle position (top/bottom) individually
- Support for different file encodings
- Set global defaults for all files
- Simple and intuitive command-line interface
Installation
pip install srtmerger
Usage
Python
Running in your Python script:
from srtmerger import Merger
m = Merger(output_path="new.srt")
m.add('fa.srt', color="yellow", encoding="windows-1256")
m.add('en.srt')
m.merge()
Bash
The basic syntax is:
srtmerger [global options] file1.srt[:options] file2.srt[:options] ...
Each subtitle file can have its own configuration using colon-separated options:
e=VALUE,encoding=VALUE: Set the file encoding (e.g., utf-8, utf-16)c=VALUE,color=VALUE: Set the subtitle colortop: Position the subtitles at the top of the screen
Global Options
-o,--output: Set path for the output file-e,--output-encoding: Set encoding for the output file-E,--default-encoding: Set default encoding for all files-C,--default-color: Set default color for all files-T,--default-top: Set default top position for all files
Examples
- Basic merge of two subtitle files:
srtmerger sub1.srt sub2.srt -o output.srt
- Set specific options for each file:
srtmerger sub1.srt:encoding=utf-8:color=yellow:top sub2.srt:color=blue --output output.srt
The above command is equivalent to:
srtmerger sub1.srt:e=utf-8:c=yellow:top sub2.srt:c=blue -o output.srt
- Use global defaults with some overrides:
srtmerger -o output.srt -E utf-8 -C white sub1.srt sub2.srt:color=blue
Development
Prerequisites
- Python 3.11 or higher
Setting up Development Environment
- Clone the repository:
git clone https://github.com/iraj-jelo/srtmerger.git
cd srtmerger
- Install in editable mode with test dependencies:
pip install -e .
Running Tests
Run all tests:
python -m unittest discover -s tests -v
Run a specific test file:
python -m unittest tests/test_main.py -v
Contributing
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature/my-new-feature - Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
- iraj-jelo - Initial work - GitHub
Changelog
[0.1.0] - 2025-01-12
- Initial release
- Basic subtitle merging functionality
- Support for custom colors and positioning
- File encoding options
- Command-line interface
[0.1.1] - 2025-02-12
- Bug fix for importing
ColorandMergerclasses in Python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file srtmerger-0.1.1.tar.gz.
File metadata
- Download URL: srtmerger-0.1.1.tar.gz
- Upload date:
- Size: 64.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e881d4cc28b15baabd5d6fd9f91ab753c71f952571ed64d4f39bbc93ab109b3
|
|
| MD5 |
06fd0865a09d0a151a31960262b1dede
|
|
| BLAKE2b-256 |
57ab65399d8915e04f7445c9b02748f1e7f8b77f845a09c6d4741869ba2b1f19
|
Provenance
The following attestation bundles were made for srtmerger-0.1.1.tar.gz:
Publisher:
python-publish.yml on iraj-jelo/srtmerger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
srtmerger-0.1.1.tar.gz -
Subject digest:
6e881d4cc28b15baabd5d6fd9f91ab753c71f952571ed64d4f39bbc93ab109b3 - Sigstore transparency entry: 735546919
- Sigstore integration time:
-
Permalink:
iraj-jelo/srtmerger@bd7a8a1bda801dfeda915318506671ebddfe78d7 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/iraj-jelo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bd7a8a1bda801dfeda915318506671ebddfe78d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file srtmerger-0.1.1-py3-none-any.whl.
File metadata
- Download URL: srtmerger-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33988bda97c69e676545bccb76e3f11fbb29e3524286988c5a5bb62afdc932a4
|
|
| MD5 |
aadf2cb16baecbebb7c850e60533ab09
|
|
| BLAKE2b-256 |
85c8c8a3fec2b7823afd1af91d5dacc73e9e05ed9c8bb560e4423ccf6e70d280
|
Provenance
The following attestation bundles were made for srtmerger-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on iraj-jelo/srtmerger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
srtmerger-0.1.1-py3-none-any.whl -
Subject digest:
33988bda97c69e676545bccb76e3f11fbb29e3524286988c5a5bb62afdc932a4 - Sigstore transparency entry: 735546920
- Sigstore integration time:
-
Permalink:
iraj-jelo/srtmerger@bd7a8a1bda801dfeda915318506671ebddfe78d7 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/iraj-jelo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@bd7a8a1bda801dfeda915318506671ebddfe78d7 -
Trigger Event:
release
-
Statement type: