Conversion from srt with italics to tx3g has issues

Issue #407 closed
David Gasperoni created an issue

I used Subler to create mp4 files starting from mkv + srt files. Needless to say with Subler I also added all sorts of information like cover art, tags, all the good stuff that you good hearted people enable.

I had opened a bug with VLC, because I thought there was an issue in the player, since with QuickTime X there were no issues and it only appeared with subtitles embedded in mp4 files and not with side-loaded srt files. The problem though is that italic is often messed up. I uploaded a short clip highlighting the issue in VLC: https://cl.ly/0U2c0E3M442T The developers of VLC looked into the issue and found problems in the subtitle track.

Not only some subtitles are mysteriously small, sometimes the styling is applied wrongly. See the example above: when there is the caption

Time to shine your
<i>cojones</i> and get to work.

The first line is also italicized and the word cojones is rendered smaller then the rest of the sentence. If it is an issue with the converter from srt to tx3g, can it be fixed? And out of curiosity, why at all set the size of the text? Can't it be left to the player to set it?

Comments (28)

  1. Damiano Galassi repo owner

    It works ok in QuickTime Player 7. So it's a VLC bug. I would recommend an alternative player like mpv, VLC is quite buggy lately and their next major release is not out yet.

  2. David Gasperoni reporter

    I agree that VLC is quite buggy… the same video above has its subtitles placed at the top instead of the bottom in the most recent versions. I'll update my bug report to them with your note too.

    Also, rendering changes between versions:

    VLC 2.2.8 VLC 2.x - Screen Shot 2018-01-01 at 19.03.45.png

    VLC 3.0 VLC 3.x - Screen Shot 2018-01-01 at 19.04.01.png

    Notice the difference in applying italics.

  3. Damiano Galassi repo owner

    The handler "sbtl" was introduced by Apple. So I can understand respecting the specs if the handle is "text", but "sbtl" was an Apple addition. So they should respect whatever QuickTime does.

  4. Damiano Galassi repo owner

    Btw, Subler set the right track height and offset (if there is a video track when you mux the subtitles), but other apps like HandBrake does not.

  5. fc

    Your mp42mux library is broken encoding samples, mixing height relative and arbitrary font size. The only diff between pure 3GPP and Apple, is that it SHOULD set all sizes to 5%...

  6. Damiano Galassi repo owner

    Well, I changed it to make it work in VLC 3. Please check the off by one style error in VLC.

  7. David Gasperoni reporter

    @galad87 thank you, are there nightly builds that I can try? I would need to setup Xcode just to try this.

  8. David Gasperoni reporter

    I see… now it's pretty weird between players. I'm encoding again from scratch the Mr. Robot episode. The best seems to be QuickTime which simply renders the text at the size it wants.

    VLC uses the defined size in the file, by which I mean that changing the size of OSD in the settings doesn't change the subtitle size (which is arguably not desirable, if i want bigger subtitles they should proportionally become bigger, no?). Though, while QuickTime renders only "cojones" as italics, VLC 2.2.8 italicizes also the first line, and VLC 3.0 italicizes both lines.

    mpv is totally broken now… when there's styling like italics, the subs take the width of the screen, and become huge! sometimes (when there are two lines maybe?) the last two characters are rendered smaller then the rest.

  9. David Gasperoni reporter

    I now downloaded the latest nightlies, and that's right!! Both 3.0 and 4.0 branches work correctly. I guess it was fixed in the last few days because only days ago I downloaded the latest VLC 3.0.

    Well now the problem is isolated to mpv, really… recapping, on the macOS side QuickTime and unreleased VLC are okay. I tried to download MPlayer on Ubuntu 17.10 and I see that the styling wasn't applied, but at least the text is uniform. mpv obviously broken here too.

  10. fc

    no-one cares about TX3G because that's non portable and has impossible authoring 'by hand'. Why would you remux in tx3g when you just authored a srt for that purpose ? no surprise features are totally untested.

  11. David Gasperoni reporter

    Hold on… VLC 3.0 doesn't render ALL italicized text. It misses some of them, like the two captions before the cojones one.

    @fcartegnie I had to redo the muxing with the original source, that file you see there is old… if you look at it the cojones is small. Here is the new file: https://cl.ly/3q0C191r3h3u/new-mux.mp4 If you use 2.2.8 the lines before cojones are italic, as it was in the original srt. In 3.0 they're not italicized.

    Well I wanted to keep mp4 instead of mkv, and also embed the srt in the file instead of living alonside of it. At the same time I'm using Subler because of the fancy metadata stuff. I didn't even know tx3g was a thing before I opened this issue.

  12. David Gasperoni reporter

    For reference to the new mux file, here I extracted the srt again using MP4Box:

    1
    00:00:01,503 --> 00:00:04,464
    I’m a blind man to
    what Vera sees in this dude.
    
    2
    00:00:04,549 --> 00:00:08,387
    Amen. Techie computer hacker genius,
    my thick Dominican dick.
    
    3
    00:00:10,891 --> 00:00:12,893
    <i>When you have control of that,</i>
    
    4
    00:00:12,979 --> 00:00:15,231
    <i>you basically have control
    of the cell doors.</i>
    
    5
    00:00:18,069 --> 00:00:20,238
    <i>But what these morons
    don’t know is,</i>
    
    6
    00:00:20,907 --> 00:00:24,035
    <i>it’s almost impossible
    without any research.</i>
    
    7
    00:00:24,371 --> 00:00:26,415
    Time to shine your
    <i>cojones</i> and get to work.
    

    Screen Shot 2018-01-03 at 20.02.15.png

    Screen Shot 2018-01-03 at 20.01.09.png

    Screen Shot 2018-01-03 at 20.01.41.png

    Compared to QuickTime: Screen Shot 2018-01-03 at 20.03.14.png

  13. fc

    I have no idea if the samples i have are stripped of any metadata, but if that's not done, you should really add authoring tool and version when producing a file. That's too late for hotfixing old files.

  14. David Gasperoni reporter

    @fcartegnie I only made two clips. I did not update the one in the first comment, I only added a new one made with the new build from Subler, it's conveniently called new-mux.mp4: https://cl.ly/3q0C191r3h3u/new-mux.mp4

    This new mux has the sizing fixed, but I noticed that some captions are not properly style in 3.0

  15. bmrs

    I've also had troubles with .srt files containing italics text. I've tested before and after using Subler by extracting the subs track, using the shell command:

    ffmpeg -I file.mp4 -vn -an -codec:s:X:Y srt ~/Downloads/sub.srt
    

    The .srt file before is clean, but after saving .mp4 file with .srt file via Subler, italics passages are surrounded by:

    <font size="40"><i><font size="24"><font face="Arial">Street Gang, here's Almighty.</font></font></i></font><font size="40"></font>
    

    It may explain why VLC does not handle these words correctly. Would there be a way to fix that?

  16. Damiano Galassi repo owner

    Download the test build you can find up here, export the subtitles to srt, and reimport them.

  17. bmrs

    It's a bit better, the font size isn't changed anymore:

    <font size="40"><i><font size="40"><font face="Arial">Street Gang, here's Almighty.</font></font></i></font>
    

    But still these (unnecessary?) "font" tags, which sometimes are misplaced:

    <font size="40"><i><font size="40"><font face="Arial">I knew they were up the</font></font></i></font><font size="40">re,</font>
    

    Could there be an option to get rid of every "font" tags?

  18. Damiano Galassi repo owner

    That's not the way tx3g is stored in the mp4 file. tx3g is a binary format, and you are converting it srt when you are exporting it in subler or ffmpeg.

  19. Log in to comment