Widescreen shows are currently encoded with letterboxing, just as they broadcast. But this is
wasteful in two respects. First, those black bars on the top and bottom are actually being
encoded in the video frames. Even when we shrink the video height to 320 pixels, those bars
add 40 pixels to the top of the screen and another 40 pixels to the bottom, which means that
25% of each frame we encode is just needless black space. Second, to maintain a 4:3 aspect ratio
when scaling down to 320 pixels of height, we get only 426 pixels of width. But we you cut out
those extraneous black bars on the top and bottom, we can use up the entire 480 pixels of
width. (The corresponding height, given that widescreen footage has a 16:9 aspect ratio, is
9/16*480 = 270 pixels -- but because H.264 video is best encoded with dimensions that are
multiples of 16, we should round this to 272 pixels.)
Because video downloaded off the Tivo always has 480 pixels of vertical resolution (although the
horizontal resolution varies with the anamorphic encoding), we can handle this pretty easily --
just tell the encoder to crop off the top 60 pixels and the bottom 60 pixels, then tell it to scale to
a maxWidth of 480 and a maxHeight of 320. For HandBrake, we just need to change part of the
encoding string to: "--crop 60:60:0:0 --maxWidth 480 --maxHeight 272". (I recommend
making these changes on top of HandBrake encoding options I recommended Issue 62.) There
are comparable settings available when using mencoder, but I haven't looked up what specifically
they would be.
Tivo usually knows in the guide data whether a program is letterboxed or not; it appears in the
program description when viewed on the Tivo. It doesn't appear in the program description as
reported by iTivo, but I believe the Tivo reports this somewhere else in the xml data we
download (I think that you currently note this when writing the text files for pyTivo, for instance).
It would be a nice touch if iTivo could identify when the user queues up a
widescreen/letterboxed show and recommend using these widescreen encoding options instead.
Labels: -Type-Defect Type-Enhancement