mattmartini / itivo

Automatically exported from code.google.com/p/itivo
Other
0 stars 0 forks source link

Optimized encoding for widescreen (letterboxed) shows #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by snov...@gmail.com on 14 Dec 2008 at 11:48

GoogleCodeExporter commented 9 years ago
Sadly, iTivo is a piece of crap applescript code (hey I didn't write the code, 
I've
just been adding layer upong layer of mess).  One of the main downsides is that 
the
encoder doesn't actually get access to the xml from the tivo (although I guess 
it
shouldn't be THAT much work to enable it.. but I'd rather avoid it if I had to).

  Anyways, I'm pretty sure vertical resolution can also be 720 and 1080 from the
tivoHD and S3 tivos..   But the issue of encoding anamorphic correctly still
stands...  But, ermm.. I'm a little lost as to how to make it generic..

  Leaving this as an enhancement request (mostly the enhancement is to have all the
tivo info available to the encoder)....

Original comment by yoav.yer...@gmail.com on 15 Dec 2008 at 2:46