Hard stutter on certain HTML animations

You can start Caspar under Windows with parameters, but the first parameter given must be the name of the config-fiel to be used. So for instance:

casparcg.exe casparcg.config --disable-web-security

works very well. I never tried --ignore-gpu-blacklist but I guess, that will work too.

Didikunz is right. I started with config-file but didn’t know that the proces fails otherwise. So it should be something like that:

casparcg.exe casparcg.config --ignore-gpu-blacklist --enable-gpu-rasterization --disable-software-rasterizer

The graphics settings in detail:

Setting Recommended Option Explanation
Image Scaling Off Prevents GPU from scaling resolutions, ensuring CasparCG works with fixed resolutions (e.g., 720p, 1080p).
Anisotropic Filtering Off CasparCG doesn’t require this, and disabling it reduces GPU load.
Antialiasing – FXAA Off Prevents conflicts with OpenGL-based anti-aliasing in CasparCG.
Antialiasing – Setting Application-controlled Lets CasparCG control anti-aliasing as needed.
Antialiasing – Gamma Correction Off Disables unnecessary gamma correction as CasparCG handles this internally.
Antialiasing – Mode Application-controlled Ensures CasparCG has full control over anti-aliasing.
Antialiasing – Transparency Off Disabling this prevents conflicts with CasparCG’s transparency layers.
CUDA – GPUs Select all NVIDIA GPUs Ensures the dedicated NVIDIA GPU is used for CUDA acceleration.
CUDA System Memory Fallback Policy Prefer device memory Prioritizes GPU memory usage for optimal performance.
Triple Buffering On Helps improve OpenGL performance by preloading frames.
Power Management Mode Prefer maximum performance Prevents the GPU from entering power-saving mode, ensuring consistent performance.
Background Application Max Frame Rate Off (0) Ensures the frame rate is not limited when CasparCG is running in the background.
Max Frame Rate Off (0) Allows CasparCG to run at its natural frame rate without restrictions.
Low Latency Mode Off Helps avoid potential conflicts with OpenGL.
Multi-Frame Sampled AA (MFAA) Off Disabling MFAA avoids rendering issues and improves compatibility.
OpenGL GDI Compatibility On Ensures that GDI-based applications (like CasparCG) work correctly with OpenGL.
OpenGL Rendering GPU Select NVIDIA GPU Forces the use of the dedicated GPU instead of integrated graphics.
Texture Filtering – Anisotropic Sample Optimization On Improves GPU efficiency with minimal impact on visual quality.
Texture Filtering – Negative LOD Bias Clamp Prevents unnecessary texture flickering or aliasing effects.
Texture Filtering – Quality High performance Prioritizes performance over quality, which is suitable for CasparCG.
Texture Filtering – Trilinear Optimization On Optimizes GPU load while maintaining acceptable texture quality.
Threaded Optimization Auto Allows the NVIDIA driver to decide if multi-threading is beneficial.
Vertical Sync (V-Sync) Off CasparCG handles its own frame synchronization, so V-Sync can interfere.
Pre-Rendered Virtual Reality Frames 1 Minimizes latency when rendering frames (not critical for CasparCG, but it helps).
Vulkan/OpenGL Present Method Auto or OpenGL Ensures proper OpenGL functionality, as CasparCG relies on OpenGL.

Now that the server is running with parameters as Didikunz suggested, GPU rasterization is working. However, I’m still facing a stuttering issue with the simple text animation in HTML template. The animations only run smoothly when I open the FPS meter in Developer Tools.

Here’s the HTML code. Would you mind testing it?

<!DOCTYPE html>
<html>

<head>
	<title>test</title>
	<style type="text/css">
		body {
			width: 1024px;
			height: 576px;
			margin: 0px auto;
			padding: 0;
			background: transparent;
			overflow: hidden;
			text-rendering: optimizeLegibility;
			-webkit-font-smoothing: antialiased;
		}

		#news {
			position: absolute;
			top: 14px;
			left: 52px;
			width: 885px;
			height: 57px;
			color: wheat;
			font-size: 50px;
			text-align: center;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		#inner {
			position: absolute;
			white-space: nowrap;
			transform: scale(0);
			will-change: transform;
			/* animation: scale 4s linear infinite; */
		}

		#bg {
			position: absolute;
			top: 11px;
			left: 35px;
			width: 925px;
			height: 62px;
			object-fit: fill;
		}

		@keyframes scale {
			0% {
				transform: scale(0);
			}
			40% {
				transform: scale(1);
			}
			80% {
				transform: scale(1);
			}
			100% {
				transform: scale(0);
			}
		}
	</style>
</head>

<body>
	<video src="https://files.catbox.moe/a9v502.webm" width="100%" height="100%" id="bg" autoplay loop muted></video>
	<div id="main">
		<div id="news">
			<span id="inner">MEDIATEK'S MOST POWERFUL FLAGSHIP ANDROID CHIP OFFICIALLY ANNOUNCED</span>
		</div>
	</div>
	</div>

	<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function () {
			var tl = gsap.timeline({ repeat: -1 });
			tl.to('#inner', { scale: 0.96, opacity: 1, duration: 0.5 }, 'label4')
				.to('#inner', { scale: 1, duration: 8})
				.to('#inner', { scale: 0, opacity: 0, duration: 0.6 })
				.to('#inner', { scale: 0,duration: 2 });
		});

		function play() { }

		function stop() { }

		function update(str) { }
	</script>
</body>

</html>

Your file works smooth on my machine. But I tried to optimize gpu rendering in your code although. It’s using the Web Animations API:

test.html (1.8 KB)

First of all, thank you @knoepsche for your time and testing this HTML.

I tried to use Web Animations API, as you suggested, but noticed that if you slow down the animation speed, then this library is also stucking while scaling.

So, the main issue is something at the rendering side because when we enable the FPS meter or other options in the rendering tab in the developer tools or when we open the same file in the browser then animation is smooth and fine with any library.

Can we know what changes happen when we enable options in the Rendering tab?

I was testing this animation issue and found that OBS v30.2.3 plays the animation very smoothly, the same as in the Chrome browser. So after checking the chrome://gpu/ status, I noticed the difference between OBS and CasparCG is that in OBS, WebGPU is disabled.

Maybe WebGPU does indeed have performance issues compared to WebGL or WebGL2? However, I don’t know how to disable WebGPU for testing animation in CasparCG. Does anyone here know how to do it?

CasparCG shows WebGPU enabled in chrome://gpu/

and according to https://webgpureport.org/ webgpu adapter not found or failed.

But the report from https://webgpureport.org/ for the Chrome browser on the same machine has different results.

I hope that helps. Maybe this isn’t related to the animation issue, but I’m sharing it here for information purposes.

Using the --disable-frame-rate-limit flag makes animation smooth but requires additional hardware resources, so I think the frame rate limit should be capped.

is it safe to use this flag with CasparCG ?

I don’t see, how this flag should help, as video always has a fixed framerate and so it cannot show more frames.

The CEF --disable-frame-rate-limit flag generally won’t increase the output frame rate of CasparCG. This attempts to remove any artificial limits on the frame rate at which CEF renders in html template. this allows CEF to render as fast as the hardware allows.

In this case, it is helping to render the animation smoothly, regardless of why the animation is stuttering, but this isn’t a good approach because disabling the frame rate limit is leading to higher CPU and GPU usage.