Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denver-code/cosb
COSB - Call of Subtitle. Add subtitles to your video in the CoD MW I-III style
https://github.com/denver-code/cosb
callofduty pymovie python subtitles video
Last synced: 3 days ago
JSON representation
COSB - Call of Subtitle. Add subtitles to your video in the CoD MW I-III style
- Host: GitHub
- URL: https://github.com/denver-code/cosb
- Owner: denver-code
- Created: 2024-03-03T14:54:52.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-03-03T16:05:54.000Z (12 months ago)
- Last Synced: 2024-03-04T16:36:17.832Z (12 months ago)
- Topics: callofduty, pymovie, python, subtitles, video
- Language: Python
- Homepage:
- Size: 14.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# [WIP] COSB - Call of Subtitle
A simple tool to add subtitles to your video in the CoD MW I-III style.# Example
> [Note] Click on image.
![]()
![example](example.png)### Code
```python
from cosb import add_subtitles_to_videostyle_file = "style.json"
video_file = "vid.mp4"
subtitle_file = "subs.json"
output_file = "output.mp4"
add_subtitles_to_video(video_file, subtitle_file, output_file, style_file)
```# Installation
```bash
git clone https://github.com/denver-code/cosb
cd cosb
poetry install
```# Usage
1. change the `_style.json` to `style.json` and modify it to your liking
2. change the `_subtitles_.json` to `subtitles.json` and modify it to your liking. This is the place where you can add your subtitles.
3. Provide `vid.mp4` in the root directory or rename `_vid.mp4` to `vid.mp4` to use the provided example video.then run `main.py`, you able to modify it to your liking or create your own script.
```bash
poetry run python main.py
```# Style
The style file is a json file that contains the following fields:
```json
{
"nameColors": {
"enemy": "#CD716D",
"friednly": "#86B9E1",
"neutral": "#C5E3BA"
},
"textColors": {
"general": "#F7F7F9"
},
"styles":{
"stroke": 0,
"strokeColor": "transparent",
"fontSize": 24
},
"duration": 3,
"padding": 100
}
```# Subtitles
```json
[
{
"name": "Captain Price",
"text": "From now.... She's yours.",
"type": "friednly",
"startTime": "00:00:01"
},
{
"name": "Graves",
"text": "Alright, let's go.",
"type": "enemy",
"startTime": "00:00:02"
}
]
```# Plans
- [x] Add basic support for multiple characters
- [x] Render the suptitles from the file
- [x] Color of the name will be based on the type and will be different from text color
- [ ] Add support for more video formats
- [ ] Change location of the subtitles when multiple characters are speaking
- [ ] Breaking the subtitles into multiple lines when the text is too long
- [ ] GUI
- [ ] Add Custom Fonts