Elusien WebVfx: How to solve the aliasing flickering on serif / monospace fonts with an opacity animation effect

Hello,

After a few days, I have eventually found a workaround to solve this problem!

Just a quick summary about what was happening:

  • In my Shotcut project, I have a 15s credits part at the end of the timeline.
    It is a color element (color:#ff000000) with a filter “Text: HTML” applied to it. The add-on “WebVfx.js” is enabled (last 1.11 version).
  • The text is displayed in white on a black background.
  • The animation consists of a short list of credits, fading in from 15% to 30% of the total duration (starting at 15% because I want to slightly delay the FadeIn of this element after an other one), then starting to fade out at 90% until completely invisible at 100%.
  • No other effect than opacity animation.
  • On the body element of my HTML file, I have set the data-control=‘15:30’ attribute (15 seconds of duration on a 30 frames per second video). On the timeline, my color element has a duration of 17 seconds to make sure the javascript animation runs until its end.
  • The font I am using is “Courier New” (.ttf files in my “C:/Windows/Fonts” directory).
  • When playing this final part in Shotcut, the animation scenario is executing correctly. The credits fade in, but at 30% of the total duration (when it is supposed to be at opacity:1) here is when the bug happens: the aliasing of the characters seems to “flicker”. As if suddenly the font was displayed with a slightly thicker font-weight. Looking normally thin of the last frame of the Fade In, then slightly thicker on the next frame. Visually it looks a bit messy! I hope this makes sense for you…
  • I noticed this behaviour also with other serif or monospace fonts, but not with sans-serif like Arial (which animates perfectly). Quite mysterious… I suspect this has to do with the way that “font-smooth” or “-webkit-font-smoothing” CSS properties are managed by WebVfx, but I can’t figure out how to contact its author Elusien.

Here is an excerpt of my HTML file:

<body data-control='15:30'>
<div class='webvfx' data-animate='{
    start:      0,
    end:        1,
    ease:       "easeInOutSine",
    0% :	{opacity:0;},
    15% :	{opacity:0;},
    30% :	{opacity:1;},
    90% :	{opacity:1;},
    100% :	{opacity:0;} }'>

    <strong>Credits</strong><br/>
    <i>Song's title</i> &mdash; Artist (Year)

</div>
</body>

Without success, I have tried to link my font as @font-face (with converted .weoff and .weoff2 “Courier New’ font files) in the section of my HTML file. Also tried to override “font-smooth” or '-webkit-font-smoothing” CSS properties (with ‘none’ value). And also a few other unsuccessful attempts…

Eventually, here is the workaround I have found: in the animation parameters, you have to set the opacity at 0.999 instead of 1. Here is my previous HTML excerpt with this modification included:

<body data-control='15:30'>
<div class='webvfx' data-animate='{
    start:      0,
    end:        1,
    ease:       "easeInOutSine",
    0% :	{opacity:0;},
    15% :	{opacity:0;},
    30% :	{opacity:0.999;},
    90% :	{opacity:0.999;},
    100% :	{opacity:0;} }'>

    <strong>Credits</strong><br/>
    <i>Song's title</i> &mdash; Artist (Year)

</div>
</body>

No more flickering!
I hope this helps some of you experiencing the same issue.

Best regards,
Clément

Another thing:

Amongst my multiple attempts, I also wondered if this bug could be caused by the fact that - in my Shotcut project - the main source video’s framerate is 29.771200 fps (I don’t understand why this video file has this value… No info about this fps setting anywhere on the web! This footage was recorded on a Mac webcam with Quicktime Player with the High quality setting. My Shotcut project is on Windows 10 and the video file has not been converted before being inserted. Anyway…).

So, in my HTML file, still having the animation parameter set at “opacity:1” at 30% I tried to modify to match this fps value (I tried ‘15:29.771200’ and ‘15:29.7712’ and ‘15:29,7712’)… without success neither!

So, at this point, the “opacity:0.999” workaround is the only satisfying solution I have.

1 Like

Just seen this, browsing while locked-down in Cyprus, so did a few experiments.

This is a problem with the rendering of the Courier New font (and possibly others) in the web-engine used by Shotcut. It is associated with the “<strong>” (i.e. font-weight: bold) element. It does not seem to occur if you change the font to Times New Roman. It is nothing to do with “font-smooth”. This is not a problem with the latest Google Chrome browser, just the one used in Shotcut. I’m afraid there is probably nothing that can be done other than the fix you have, or use a different font. [It may just be a problem with MONOSPACED fonts, I’ll do some more testing]

There are two images below. The first using the “Courier New” font and the second using the “Times New Roman” font. In each image you will see two rows of text, each with two "M"s in them. In the first row, the first M has opacity 1 and the second M has opacity 0.9. In the second row the opacities are swapped. Note how when the opacity is not equal to 1 there is clipping on the M, which is why you see the strange glitch as it moves from just less than 1 to equal to 1 in Shotcut.

1 Like

Grateful thanks to @clmntbk and @Elusien for this information. I’d noticed occasional flickering with some fonts myself at times, and this workaround and explanation will be very useful knowledge for future projects… Thanks! :grinning:

Just tried it with Miriam Mono CLM monospaced font and that was OK. So it looks like the Courier New font is the culprit, when used with the <strong> element and opacity is less than 1, when the “clipping” comes into play. It could of course be happening with other fonts but MM-CLM is the only one on my Windows 10 system that is a monospaced serif font, other than Courier New, so I cou;dn’t try with any other.

This topic was automatically closed after 90 days. New replies are no longer allowed.