Git Product home page Git Product logo

python-srt2ass's Introduction

python-srt2ass

Python script to convert Subtitle formats from .srt to .ass. By default it will add black background (opaque box) with yellow font color, useful to hide foreign hardsub from movie

Requirements

How to use

python srt2ass.py "file"

Sample

using command line

python srt2ass.py file1.srt
or
python srt2ass.py file1.srt file2.srt file3.srt

using as module

from srt2ass import srt2ass

assSub = srt2ass("file.srt")
print('ASS subtitle saved as: ' + assSub)
# ASS subtitle saved as: file.ass

python-srt2ass's People

Contributors

ewwink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python-srt2ass's Issues

SyntaxError when converting

  • Problem
File "/path/to/srt2ass.py", line 69
    tmpLines += '\N' + line
                     ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: malformed \N character escape
  • Solution
    at line 69, '\N' character has to be changed into '\n'

Some lines getting missed

After converting some lines get skipped, for example the original srt file contains 500 lines, the converted version (ass) contains 450 lines !

請問要如何增添"此字幕僅供學習交流,請勿用於商業用途。"這一行?

If i need the following format, how to add "Dialogue: 0,0: 00: 00.00,0: 00: 03.85, Logo ,, 0,0,0 ,, Dialogue: 0,0:00:00.00,0:00:03.85,Logo,,0,0,0,,此字幕僅供學習交流,請勿用於商業用途。 " This line

[Script Info]
ScriptType: V4.00+
Collisions: Reverse
PlayResX: 1280
PlayResY: 720
Timer: 100.0000
WrapStyle: 0
ScaledBorderAndShadow: no

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Microsoft JhengHei,68,&H0000FFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,3,2,50,50,12,1
Style: Comment,Microsoft JhengHei,40,&H00FFFFFF,&H0000FFFF,&H00000000,&H64000000,-1,0,0,0,100,100,0,0,1,2,2,2,50,50,200,136
Style: Preview,Microsoft JhengHei,65,&H00FFFFFF,&H000000FF,&H00000080,&H64000000,-1,0,0,0,100,100,0,0,1,2,3,1,50,50,12,1
Style: Review,Microsoft JhengHei,65,&H120456DF,&H000000FF,&H00000000,&H00000000,-1,-1,0,0,100,100,0,0,1,2,3,2,50,50,12,1
Style: Song,Microsoft JhengHei,50,&H00FFFFFF,&H000000FF,&H00A37C00,&H00000000,-1,-1,0,0,100,100,0,0,1,2,2,9,50,50,12,1
Style: Logo,Microsoft JhengHei,45,&H00FFFFFF,&H0000FFFF,&H00000080,&H80000000,-1,0,0,0,100,100,0,0,1,3,1,2,20,20,3,136

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:03.85,Logo,,0,0,0,,此字幕僅供學習交流,請勿用於商業用途。

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.