logo Sign In

zofrex

User Group
Members
Join date
16-Dec-2020
Last activity
13-Mar-2021
Posts
2

Post History

Post
#1394376
Topic
Project Threepio (Star Wars OOT subtitles)
Time

Ah, that’s useful, thank you! I was trying with version 7.0.10-47 but I tried a few different ones, going back as far as 7.0.9-27, without any success. I have now tried 7.0.10-23 as well but no change there.

Googling the error message though I found this which made me think the issue is libpango, not imagemagick, and I’ve been using the same version of libpango every time.

I checked out that possibly-dodgy binary archive, and ImageMagick 7.0.10-23 on Windows used pango 1.42.4 which is a little older than any I had tried so far. Using that version on Linux works!

Seeing as this may be helpful to anyone else trying to do this, here’s my Dockerfile that I made to run these scripts. It should reliably and consistently create a working environment for running the Python scripts.

Rather than copy the Python script in I’m mounting the python folder, so I don’t need to rebuild if I edit the scripts. So I’m running it something like this:

docker build --tag subtitles .
docker run -it --name sub --mount type=bind,source="$(pwd)/out",target=/subs/out --mount type=bind,source="$(pwd)/python",target=/subs/python subtitles bash

The subtitles are still rendering but they look correct so far, so fingers crossed that’s it sorted now!

As for why it’s happening… I apologise if I’m teaching my grandmother to suck eggs here, but I think using random unassigned unicode codepoints for replacement characters is the issue, and seems likely to keep causing issues in the future, seeing as no tool will really know how to handle them. I was wondering if you had a reason to do it this way rather than adjusting the kerning in the truetype font file instead? Again, my apologies if this is something you’ve already considered and had a reason not to use!

Post
#1394201
Topic
Project Threepio (Star Wars OOT subtitles)
Time

First of all, thank you for this, this project is amazing and the PGS subtitles look absolutely fantastic.

I’m trying to generate more PGS subtitles (because there aren’t any for the mono audio track, which has a few differences) and I’ve run into a stumbling block.

I’ve mostly got it working - I have the fonts installed, ImageMagick 7, Java, pango, Python, all that jazz. It is generating PNG files and they’re 90% correct, but there’s issues with the replaced characters (apostrophes, some full stops, etc - the ones the Python script replaces with reserved codepoints) which don’t seem to be working. Most obviously, apostrophes are sideways:

It’s some combination of the -gravity setting and the custom glpyhs, I think, as the problem goes away if I either disable the character replacement or get rid of the gravity setting.

This is on Ubuntu Linux, by the way. I had no luck at all on MacOS so I figured that was a good OS to attempt it on.

I haven’t tried running the full script on Windows as I’m not sure how to override the exclusion patterns when running the .exe rather than the Python script. However, I did try rendering a single xml file generated by the script on Windows:

XML:

<span lang="en" font_desc="P3PO SW Matching" size="112773" weight="normal" foreground="white">​
 They shut down the main reactor 
 Well be destroyed for sure. 
​</span>

Command:

magick -gravity east pango:@test.txt test.png

And interestingly this gave a warning, which I didn’t get when doing the same thing on Linux:

** (process:5788): WARNING **: 20:28:18.397: couldn't load font "P3PO SW Matching Rotated-Left 110.1298828125", falling back to "Sans Rotated-Left 110.1298828125", expect ugly output.
** (process:5788): WARNING **: 20:28:18.402: couldn't load font "Sans Rotated-Left 110.1298828125", falling back to "Sans Rotated-Left 110.1298828125", expect ugly output.
** (process:5788): WARNING **: 20:28:18.406: All font fallbacks failed!!!!
** (process:5788): WARNING **: 20:28:18.408: All font fallbacks failed!!!!

I am wondering if this is related to the issue I’m having. It seems to be, as the warning goes away if I either remove the replacement glyphs, or get rid of the -gravity option, so I think it might be a clue.

Anyway, I’m hoping this is an issue you’ve run into at some point and know what I’m doing wrong here.

Edit: I ran the script on Windows against the regular stereo mix subs just to test, and sure enough it’s spitting out those same warnings over and over, and it’s producing images like this:

So I believe it is the same issue and those warnings are probably related.