Hello Luukth,
it's not easily possible for us to add compatibility with Optifine when rendering. As a workaround, you can save your keyframes using the "Keyframe Repository" (read the docs), restart Minecraft without Optifine, load the Keyframes, render and restart Minecraft with Optifine.