asticode / go-astisub

Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)
MIT License
572 stars 110 forks source link

TTML styling conversion #9

Open saintberry opened 5 years ago

saintberry commented 5 years ago

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

asticode commented 5 years ago

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.

saintberry commented 5 years ago

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

dlecorfec commented 5 years ago

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? ;)

dlecorfec commented 5 years ago

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