Tuesday, November 1, 2022

Nemure Omoigo, Sora no Shitone ni (HD)

When we released Nemure Omoigo, Sora no Shitone ni, a nyaa downloader asked why we hadn't used the high resolution R-Raws encode instead. There were three reasons:

  1. I wanted to finish the original project, which had sat on the shelf for almost six years.
  2. The R-Raws encode required redoing all the motion tracked typesetting, because it was encoded at 30fps instead of the DVD raw's 23.976fps
  3. After redoing the typesetting, I couldn't get subs in the final mux properly synchronized.

These rationalizations/excuses/problems have all been overcome, and Orphan and M74 are now releasing a 1080p version of Nemure Omoigo. The higher resolution allows a bit more typesetting to be done. It also makes source issues, like aliasing in thin lines, more obvious:

Otherwise, the two versions are the same.

I've already discussed the show in great detail, so I won't rehash the previous blog post. Instead, to fill out this post, I'll present a boring and overly long explanation of the technical issues that delayed the release.

Typesetting

When raws have different frame rates, motion tracking from one raw won't work on the other. Inter-frame object motion depends on the frame rate, so all the motion tracking must be redone. But there was another, more subtle problem. The DVD raw was anamorphic (720x480, played back as 853x480). The R-Raws web rip was flat (1920x1080). As I've found out to my cost in the past, Aegisub cannot do proper transformations on angled signs between anamorphic and flat raws; the angle is invariably wrong. (Letters angled with \fax also tend to be wrong.)

This is a simple matter of geometry. If the base of a triangle is stretched by 18.4% (the anamorphic stretch factor), then the angle of the hypotenuse to the base will change. Aegisub cannot calculate the change because it cannot be sure what the display resolution will be. The display resolution in the MKV file may or may not be correct; Aegisub has to rely on the resolution of the video stream. And in an anamorphic encode, that's wrong.

The moral of the story is simple. Kids, don't do anamorphic encodes of DVDs. Your typesetter will thank you for it, if not right away, then eventually.

Subtitle Synchronization

I wear many hats in Orphan - editor, typesetter, QC/RC, cat herder - but one job I never touch is encoding. I simply don't understand the process or the nuances of the numerous filters, post-processors, and voodoo spells that good encoders apply to fix source problems. Many times, with my senior eyes, I can't even see the issues. Even the basics are a mystery. So when subtitles don't play properly in a muxed softsub file, even though they do play properly in the subtitling tool Aegisub, I'm utterly at sea. Which brings me to the issue of timecodes.

Timecodes are simply a list of the time, in milliseconds, for frame boundaries. Here's an example from a 23.976fps raw:

# timecode format v2
0
42
83
125
:

Basically, the times increase monotonically at 1000/23.976 = 41.7 msec. If this seems excessively verbose, the format allows for precise specification of frame boundaries in raws with variable frame rates (usually mixed 23.976fps and 29.97fps).

I first encountered timecode issues with the initial release of Tomoe's Run! The raw was at 29.97fps. At the time, Aegisub rounded differently from later tools in the chain. As a result, subtitle synchronization gradually drifted off, eventually by a couple of frames. The solution at the time was to mux in Aegisub's version of the timecodes. (I didn't realize that this solution threw off audio synchronization.) The ultimate solution was a new encode as 23.976fps. After that, I'd occasionally find raws missing one timestamp, so I always checked the timecodes in the raw and replaced them if necessary.

The HD raw for Nemure Omoigo has subtitle synchronization problems in spades. Every subtitle was off by three frames. The timecode file was strange. It should have had timestamps at 33.33msec intervals (1000/30). Instead, it began:

# timecode format v2
0
109 <- two frames missing (33 and 66); and off by 9?
133 <- extra frame?
142 <- back to "correct cadence", but still off by 9
176
209
242
276
309
:

I tried editing the timecodes file to add the missing frames; that didn't work. I tried splitting the raw at the 1 second mark (it had 1 extra second of black screen); that didn't work. I tried generating a correct 30fps timecode file; that didn't work. Finally, after a good night's sleep, I realized what to do: if every subtitle was off by three frames, I could simply add three frames (100ms) worth of delay to the subs during the mux. That worked, and it's what I will do in the future. Any experienced encoder would have hit on this solution immediately.

Summary

tl;dr. Here's the high resolution version of Nemure Omoigo, Sora no Shitone ni. You can get it from the usual torrent site or from IRC bot Orphan|Arutha in channels #nibl or #news on irc.rizon.net.

1 comment:

  1. That all sounds interesting. As a WIP typesetter myself, understand all this voodoo magic is an eye opener.

    ReplyDelete