Local Remotion Animations W/ Ollama, OpenCode, and Gemma4
from Digital Dopamine Hosted by Digital Dopamine LLC
Local Model Aspirations For all of the folks out there who want to embrace AI but also have issues with the energy consumption and cost, I’m right there with you. When AI started to become mainstream and then eventually mandatory in enterprise work, I was very reluctant to use it and train these models that my company will eventually replace me with. Well…….that happened verbatim 😅. My previous place of work has been going through rounds of layoffs after a new set of C-suite execs strolled in to make “improvements” to the business, aka, “the company isn’t making enough money so, hire offshore, fire employees with IP knowledge, and go heavy on using AI.” I’m obviously exaggerating (kinda), but the point I’m trying to make is that AI is great when you have a solid plan on how to use it and try not to rush the process. Most companies didn’t take that approach, though, and got shot in the foot because of it. Does that mean we should oppose AI? Absolutely not. I actually love what AI can be used for, and I think there isn’t enough fine-tuning out there for specific use cases. Now, with Chinese models becoming much more competitive in intelligence, the cost difference is a no-brainer, and many companies are switching to these cheaper yet very capable models. (Image Source: https://techstartups.com/2026/06/29/western-companies-are-quietly-switching-to-chinese-ai-models-as-u-s-frontier-ai-prices-rise/) Then, when you use platforms like DeepInfra as your provider, scaling becomes less of an issue, and you only pay for usage and not a monthly subscription. Add the OpenRouter API in the mix, and you have the ability to swap providers at will. If costs ever change, if one provider hits you with rate limits, or if a provider goes down completely, OpenRouter is the failsafe that will forward your request to a different provider automatically (with the proper configurations) so your clients won’t have issues with the products/software you built for them. This just goes to show how far we’ve come with AI development, and like it or not, it’s a tool almost as important as the internet itself but potentially much more dangerous. While that danger may include physical harm, I’m more worried about the mental and intellectual harm that it’s doing and will continue to do if we don’t make some major changes in how the average person should approach AI. This is why I started diving into local models, with the understanding that they are not as capable as the frontier models, but that’s the point. They are SLMs and MLMs that you can leverage, but it will still require you to do some sort of critical thinking, which is a good thing. There is absolutely no reason for people who are using AI to just chat or ask a simple question, to be using the compute power and energy consumption of the frontier models. That’s one reason why I marveled over Google’s Gemma 4 series because, in theory, they have a model that should serve on just about any device. In practice, though, I’m learning some major limitations with these models, but most of them have to do with local compute power (as well as my current lack of knowledge on how to fine-tune these systems). That isn’t to say local models will never work; we have come so far with local models already that I'm sure in the next year or so, there will be a better generation of local 1st models that will work as smoothly as using a frontier cloud model. And “smoothly” is the keyword here, because in terms of intelligence, that’s not the main selling point of these local and more ethical models. Local Model Experimentation So that leads us to this lil ol’ experiment with me trying to build a “lower third” animation for my podcast intro. A “lower third” is just an animation on the lower left or right of your screen with the host name and title, or whatever you’d like to pop up there briefly (or at least that’s how I understand it 😄). So you’d think that a local model would be able to knock this out no problem, right?? If you have a beefy enough local machine, you’re golden. However, most people do not have a $5k+ home lab that can run these local models without major lag and bottlenecks. When the Gemma4:12b model was released, I was ecstatic because it was small enough for my Mac Mini (M4) not to hit memory limits, and it allowed enough headroom for me to record on OBS without OBS crashing. But reality hit me hard when I needed this model to run efficiently in any capacity for the task at hand. So I crafted 3 separate prompts for this task since, given the small context window limit of 32k I had to set, we needed to make sure to break up the tasks into individual prompts and sessions so the 12B model can stay as focused as possible. The original prompts are below: [1/3] Create src/LowerThird.tsx. Transparent background. Static layout only, no animation yet: a 12px-tall horizontal gradient bar (linear-gradient 90deg, #7B5BF0 to #4B7BE5) at x=120 y=880, an off-white (#F4F4F6) rounded rectangle behind two lines of text: primaryText in Archivo bold 48px #111111, secondaryText in Space Grotesk 32px below it. Props: primaryText, secondaryText (zod schema). Register in src/Root.tsx: id "LowerThird", 1920x1080, 30fps, 150 frames. [2/3] Animate the entrance (frames 0-21): the gradient bar scales in from the left using spring({frame, fps, config: {damping: 200}}), the rectangle then expands from behind it, the two text lines slide up 20px and fade in with a 4-frame stagger. Use only useCurrentFrame/interpolate/spring. [3/3] Animate the exit: frames 129-150 reverse the entrance. Hold frames 21-129. Then I'll run pnpm lint and paste any errors. But these evolved greatly throughout my multiple rounds. Before we get into what the final prompts were, we need to make sure that folks who want to follow along can get set up with the tools I used during this process. Setup 0. Scaffold the Remotion project # Prereqs: Node 18+ and pnpm pnpm create video # → name the project, pick a template (Blank is fine — the agent writes the rest) cd pnpm dev Then install the skills: npx skills add remotion-dev/skills That drops remotion-best-practices into the agent folders (.opencode/skills/, .claude/skills/, .agents/skills/, …) and records it in skills-lock.json, so OpenCode — and any other agent you point at the repo — picks it up automatically. 1. Serve the model with a real context window Ollama’s default context (~4k tokens) is far too small for agentic coding — OpenCode stuffs system prompt + skill rules + file contents into context, and when it overflows, Ollama silently truncates the oldest tokens. The model “forgets” your instructions mid-task and the failure looks like model stupidity. It’s a config problem. Note for context We will be setting 2 different contexts for Gemma. One will allow me to record at the same time but will reduce my context window. The other will give a better context window for a lesser chance of hallucination. You will also need to create Modfiles for our customized models to reference. Each modfile will be above the cat call. You can name the files whatever you want, but I’ve named the models according to their context window. To bake it in permanently via a Modelfile: Smaller Context cat > /tmp/gemma4-12b-16k.Modelfile /tmp/gemma4-12b-32k.Modelfile digitaldopaminellc.substack.com/subscribe
Embed this episode
No transcript yet.