I’m thinking of something like an old screensaver—a GIF that constantly processes itself to create new parts of an image forever. The simplest example would be cycling through solid colors using irrational number increments on the color wheel, so every time you look at it, it’s showing a color it’s never shown before.
Is it possible? Yeah. Is it common? Not really.
Even while some file formats might be able to accomplish this, all computer software is ultimately just programming. You could build a script to accomplish it, because a codec is essentially just a small piece of programming!
By the way, those Microsoft screensavers have the answer. They’re .scr files.
.scr files are basically the same as .exe files, just with a different extension. You’d have to figure out how to use Windows’ APIs to show a screensaver image and wake it up without it feeling hacky.
Shadertoys might be pretty close to what you’re imagining. But like others have said, it’s basically just running a program, so the difference is mostly just a matter of philosophy.
What’s the use case? The answer really depends on that. Screensavers are one thing, generative videos are another, and standalone apps designed to run on a specific device are yet another thing.