Giter Club home page Giter Club logo

cosb's Introduction

[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

cosb's People

Contributors

denver-code 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.