Skip to content

COSB - Call of Subtitle. Add subtitles to your video in the CoD MW I-III style

Notifications You must be signed in to change notification settings

denver-code/cosb

Repository files navigation

[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.
nQP-xHUOZxA example

Code

from cosb import add_subtitles_to_video

style_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

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.

poetry run python main.py

Style

The style file is a json file that contains the following fields:

{
    "nameColors": {
        "enemy": "#CD716D",
        "friednly": "#86B9E1",
        "neutral": "#C5E3BA"
    },
    "textColors": {
        "general": "#F7F7F9"
    },
    "styles":{
        "stroke": 0,
        "strokeColor": "transparent",
        "fontSize": 24
    },
    "duration": 3,
    "padding": 100
}

Subtitles

[
    {
        "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

  • Add basic support for multiple characters
  • Render the suptitles from the file
  • 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

About

COSB - Call of Subtitle. Add subtitles to your video in the CoD MW I-III style

Topics

Resources

Stars

Watchers

Forks

Languages