Giter VIP home page Giter VIP logo

set_srt_colour's Introduction

set_srt_colour.py

This Python script is for applying custom subtitle text colour by adding your desired colour attribute into subtitle file in SRT format.

New edition are added, "srt_purplegrey_utf8.py" and "srt_purplegrey_utf16leBOM.py". They both are set to use "light purple grey / #666699" color by default as well as enhanced to handle the case when input SRT file are encoded in UTF8/UTF16le with BOM.

"srt_purplegrey_utf8.py" is for SRT in UTF8 format
"srt_purplegrey_utf16leBOM.py" is for SRT in UTF16LE with BOM (I found some srt saved in this format)

BACKGROUND

The reason why I drafted this script is due to the imperfection of the feature of dynamic LED brightness for my BenQ X12000H Projector. The pure white or any preset color of font style for subtitle will trigger the dynamic brightness in dark scene, which makes the whole dark scene too bright or we will say grey-out seriously as a result. It affects the mood of the scnene and the movie at the end. In order to fix this, I had the POC to see if subtitle in dark grey colour can be a tricks not to trigger projector built-in dynamic brightness feature in dark scene. BINGO!!! It works flawlessly!!! But I am not going to edit subtitle file one by one manually for the purpose. Therefore, this python script is born.

PREREQUISITION

It's simple a Python script so Python is a must, please ensure your system having python installed

Python download link here just in case https://www.python.org/downloads/

For both new edition "srt_purplegrey_utf8.py" and "srt_purplegrey_utf16leBOM.py", Python verion 3 is a must!!!

HOW TO USE

Run it in "command prompt" for Windows system, "Terminal" for Macintosh system, or even in NAS with Python environment installed.

The script is looking for 2 arguments, the last one is optional.
1st argument is the filename of the original srt file,
2nd argument is the optional output filename to be desired (You can skip it for sure. *** If no output filename is defined, original file with suffix defined in the script ".greyfont." as suffix will be used) )

Below is the format of the command
sh% python set_srt_colour.py input_subtitle_file.srt [***Optional_output_subtitle_file.srt]

REMARKS: You can redefine your desired colour as well as the default suffix of the output file in the script as following

font_color_code = "#333333" #Here you can define your desired colour code
file_suffix = "greyfont" #Here you can define your desired default suffix of output filename

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.