paco8 / ttml2ssa Goto Github PK
View Code? Open in Web Editor NEWConvert TTML/XML/DFXP/VTT/SRT subtitles used by Netflix, HBO, Disney+, Prime Video and others to SRT or SSA/ASS format.
License: GNU Lesser General Public License v2.1
Convert TTML/XML/DFXP/VTT/SRT subtitles used by Netflix, HBO, Disney+, Prime Video and others to SRT or SSA/ASS format.
License: GNU Lesser General Public License v2.1
Hi, the punctuation marks in the Amazon subtitles for the Arabic language are not in its correct position (It worked fine with "script.module.ttml2ssa-0.3.2.zip" before).
You could test it in the Arabic subtitle of the movie "Back to the Future Part II" on primevideo, it looks like this.
When it should look like this.
Thank you so much for your add-on, you did an excellent job, In the Netflix subtitles sometimes we get ‏
and ‎
, ‏
needs to be replaced with 'RIGHT-TO-LEFT EMBEDDING' and ‎
needs to be replaced with `LEFT-TO-RIGHT EMBEDDING' for the punctuation marks to be in the correct position in the subtitles, this PR explains the problem.
does this support Premiere Pro XML?
Converting SRT to Premiere Pro XML
To get the cmd working from any folder, it should be changed to following :
python "%~dp0src/__main__.py" %*
If one add the folder where ttml2ssa.cmd is located in the PATH, so when calling this app from some other folder it won't give an error that it cannot find src/__main__.py
.
This is a very good app, I don't know much about python but as a c++ coder it wasn't much headbreaking to get things working.
And as I like my subs in a bit custom style, it's easy to change the defaults in the ttml2ssa.py to the way I prefer.
When trying to convert a ttml file which does not have fractional parts or frames for certain timestamps the tool will fail with the following error:
Converting file.ttml to file.ssa
Opening file.ttml with encoding utf-8
Traceback (most recent call last):
File "src/__main__.py", line 209, in <module>
ttml.parse_subtitle_file(input_file, args.encoding)
File "/home/stephan/projects/ttml2ssa/src/ttml2ssa.py", line 127, in parse_subtitle_file
self.parse_ttml_file(filename, file_encoding)
File "/home/stephan/projects/ttml2ssa/src/ttml2ssa.py", line 135, in parse_ttml_file
self.parse_ttml_from_string(doc.encode('utf-8'))
File "/home/stephan/projects/ttml2ssa/src/ttml2ssa.py", line 241, in parse_ttml_from_string
ms_begin, ms_end, text, position = self._process_parag(p)
File "/home/stephan/projects/ttml2ssa/src/ttml2ssa.py", line 357, in _process_parag
ms_end = self._tc.timeexpr_to_ms(end)
File "/home/stephan/projects/ttml2ssa/src/timestampconverter.py", line 115, in fraction_timestamp_to_ms
hh, mm, ss, fraction = re.split(r'[:.]', timestamp)
ValueError: not enough values to unpack (expected 4, got 3)
Teste.pt.zip
This subtitle has error
Has possible joiner and merge same text?
Hi there, I'm trying to edit the .ssa file produced by your tool, using Aegisub. It says the file is malformed:
I also tried to load (without modification) the produced file in MPC-HC and if fails with no error.
Using a random online tool to do the conversion, this is what I've found:
yours
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, BackColour, OutlineColour, Bold, Italic, Alignment, BorderStyle, Outline, Shadow, MarginL, MarginR, MarginV
Style: Default,Arial,50,&H00FFFFFF,&H40000000,&H00000000,0,0,2,1,2,3,40,40,40
[Events]
Format: Layer, Start, End, Style, Text
Dialogue: 0,0:00:06.31,0:00:07.52,Default,{\i1}This doesn't work{\i0}
another online tool
[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,monospace,20,&H00FFFFFF,&H0300FFFF,&H00000000,&H02000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
[Events]
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:06.31,0:00:07.52,Default,,0,0,0,,{\i1}This works{\i0}
Other than minor differences in the style, the main difference is that yours lacks some format fields. It makes sense given the error message "not enought fields".
I'm no subtitle expert, I don't know what's the minimum set of fields required, here there's a good description of what they do but no mention if they are mandatory or not: https://forum.videohelp.com/attachment.php?attachmentid=33290&d=1440307546
Anyway, I'm forking (main...flagg19:ttml2ssa:main) and patching it up adding all missing fields with an empty/default value just to make it work because I need it. I'm opening this issue in case you didn't know and want to do a proper fix.
Hello Paco8.
I would like to ask you to consider integrating zhconv into the add-on. Let me explain why the streaming service needs Chinese conversion. Because there are multiple variants of Chinese (like French and Canadian French).
So now there is a problem that although the major international streamers (Netflix, Prime Video, Disney Plus) generally provide both Simplified and Traditional Chinese subtitles, many times the translation quality of Simplified Chinese is not as good as Traditional Chinese.
I can convert subtitles through external subtitle tools. But it would be very convenient to convert within Kodi through this add-on.
Thank you for making a very nice streaming service subtitle conversion add-on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.