asticode / go-astisub

Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TTML styling conversion

saintberry opened this issue · comments

Are there any plans to add features for converting the styling in TTML input to various output formats (I'm hoping for VTT)

Well I've prepared the code for that, but never found the time to implement it fully.

The first step would be this todo which consists of converting all the TTML string values into pointers to their correct types (like for ssa style attributes for instance).

The second step would be to implement the content of the propagate methods for each type of subtitle (the ttml one is here) which are called everytime style attributes are parsed. To do that, you'll need to check if one attribute is present (!= nil), and fill other subtitle type's style attribute accordingly. You can check this example to understand the logic.

I won't have time to work on this, but I'd be happy to review a PR.

Thanks for the detailed response. When I get sometime I'll try take a look and send over a PR.

Hello, my use case would be close (converting EBU-STL to WebVTT while keeping colors). I still can't fully understand astisub's architecture. Any additional hints for this specific case? ;)

Ah, it seemed easier than planned, see PR #12 (not sure if it's the proper way, though ...)