Friday, February 3, 2023

It's Broken, Broken, Broken

For some time, I've wondered why anime groups have taken to specifying exactly which video players they support for their releases. Some say "mpv only". Some specify others. I've finally figured out why. When it comes to compatible subtitle rendering, the fansub world is broken, broken, broken.

In the old days, most anime subbers and fans were on Windows, and most everyone used MPC-HC (media player classic home cinema) for playback and xyvsfilter for subtitle rendering. The Aegisub and CCCP projects helped enforce this by providing a uniform tool chain for the Windows world to use. Then, in short order, Aegisub stopped publishing stable releases, CCCP went out of business, and chaos ensued.

The root of the issue, as far as I can tell, is the substitution of  the portable subtitle rendering library libass for the Windows only library xyvsfilter. Using a portable library simplifies the process of producing portable players, like mpv and VLC. libass is pickier about syntax, and mistakes that xyvsfilter will accept (for example, \pos(x,y\fs40) cause libass to produce gibberish. There's no syntax checker for ASS that I know of, so it's all too easy for errors to slip by. But more importantly, libass is simply wrong in places, mostly notably in its handling of line wrapping.

ASS allows for four wrapping styles for multi-line subs, of which the default is 0: smart wrapping, top line longer. All scripts I edit are built that way. So I was baffled why the QCs for Yawara! kept asking for line breaks to be added or moved, until I found a smoking gun. Here is Aegisub's rendering of a scene from episode 72, with xyvsfilter:


And here is the same scene, with libass:

Now, I'm willing to allow some leeway about "smart wrapping", but mode 0 says top line longer. It doesn't say "top line longer unless the difference exceeds 'n' characters." In fact, libass is doing some very stupid wrapping in this case, breaking off the last word of a complete sentence. This isn't implementation leeway on an ambiguous spec. It's a bug, and it should be fixed. If I, as the editor and styling, specify top line longer, then that's what the renderer should so, unless it simply can't work due to hitting the margins.

I'm sure the younger set would tell me to give up on my ancient tool set and move to the "modern" world. However, I'm very set in my ways. I have a set of subtitling tools that work the way I like. If I were using libass, I'd be doing a lot more work to defeat this bug. In fact, I'd have to put explicit line breaks in every damned multi-line sub. Life's too short.

So here's Orphan's policy declaration. Our releases are supported on MPC-HC with xyvsfilter. If you want to use some other combination of playback and rendering, caveat emptor.