What is the best way to generate dynamic videos from template in php or laravel? [closed]

I was trying to find a way to generate videos from some templates with a mechanism similar to what happens with DOMpdf that allow to inject a blade, that can use dynamic variables to generate different content based on data, to generate a dynamic PDF that can store dynamic variables. I know that there is FFMPEG but it is not used directly to do so or maybe i don’t understand how to do it. Is there someone that found a better way? a simple and efficient way to accomplish that task?

i tried to find some resources online but there were very few answers to my problem.