Written with Kimi (kimi-for-coding).

I'm building a personal pipeline that mass-produces history explainer videos, fully automated. The visuals are simple: take a still image, zoom it slowly (the Ken Burns thing everyone does), lay Japanese narration over it, and add subtitles synced word by word.

The last step was burning those subtitles into the video. That's where I got stuck.

Hand the subtitles to ffmpeg, burn them in. This is the most boring, most well-trodden operation in all of video work. Make a subtitle file, feed it to a filter.

ass=subs.ass 

Here's what came back.

No option name near 'subs.ass' 

Sorry, no option name? I'm handing you a filename. That's it.

Maybe my syntax was off, so I tried ass=f=subs.ass instead. New answer.

Filter not found 

The filter itself. Doesn't exist.

The culprit was a minimal ffmpeg build

I stared at the configuration line of ffmpeg -version long enough, and it finally clicked.

The ffmpeg on this machine was missing, entirely, the parts you need to draw text: libass for typesetting, freetype for rendering the glyphs. It was a minimally configured build. So the subtitle filters simply weren't there. Neither was drawtext, the one that burns text onto a frame. Zero ways to put a character on screen.

"Just reinstall it then," you're thinking. So was I.

Except when I looked at the package manager's dependency list, libass wasn't in there at all. Meaning that for the build I happened to have on this machine, bumping the version would not bring subtitle support with it. This build is frozen in that shape. Upgrading was not a fix.

Leave the system alone, draw the subtitles in a separate layer

So here's the fork in the road.

  • (A) Replace the system ffmpeg with a different one that has subtitle support
  • (B) Leave ffmpeg alone and get subtitles out some other way

I went with (B). The reason is simple: I have reached into a working toolchain before and taken the whole thing down with me, more than once (lesson learned).

Here's how it works. Stop burning subtitles into the video, and instead build the subtitles as an independent layer.

  1. Draw the subtitles with an image library (Pillow, which happened to already be installed in another Python project's virtualenv) as a numbered sequence of transparent PNGs, one frame at a time. Words already spoken are white, words coming up are gray. The color walks left to right, karaoke style.
  2. Lay that sequence of transparent PNGs over the zooming video with ffmpeg's overlay (the filter that just puts one picture on top of another, which the minimal build did have).

The outcome: I touched nothing on the system. And because I'm drawing the subtitles from pixels myself, line wrapping, outlines, and the timing of the word highlight are all under my control.

Honestly? This was easier than wrestling with the fine print of a subtitle format. Which is a little ironic.

What I took away

  • I only hit this on one machine, but the same ffmpeg can be a completely different program, depending on build flags. Don't assume "this filter should be there." Not on someone else's machine, and not on your own future machine either. Check the configuration line of ffmpeg -version first, and check that the filter you want is actually in -filters. That one habit buys back half a day.
  • Overlaying subtitles as a separate layer gives you more freedom than burning them in. Sync and styling both stay in your hands. The more limited the environment, the more that separation pays off.
  • When a feature is missing from your environment, first ask whether you can substitute a combination of other tools without changing the system. Not breaking what already works turns out to be the cheapest path.

Before you burn a day on "my subtitles won't show up," go take one look at ffmpeg -version. Your ffmpeg is probably not the ffmpeg you think it is.