Saturday, December 25, 2010

Let people choose their aspect ratio

I can't count the number of times I've sat down to watch a movie with a friend or family member, and as soon as the movie starts, I hear "please tell me those black bars aren't going to be there the whole movie!"

Surely you are familiar with letter boxing. It's been evident on many movies watched at home since the early 90's (perhaps earlier, but I haven't been watching movies that long).

What causes letter boxing?

Letter boxing is related to something called the "aspect ratio". This refers, simply, to the ratio of the width of an image compared to it's height:

So if an image is 16 centimetres wide, and 9 centimetres high, then it is said to have an aspect ratio of 16x9. Often, for easy comparison, these are a reduced to a fraction of X:1, for example, 16x9 is approximately 1.78:1

When a movie or TV film is being produced, it is decided which aspect ratio it'll be filmed in. Three common aspect ratios (though by no means all), are 1.33:1 (4x3), 1.78:1 (16x9) and 2.35:1. Your TV screen also has an aspect ratio. Thus, letter boxing (which can be both horizontal and vertical) occurs when the aspect ratio of the picture your watching does not match the aspect ratio of your screen. For example:

TV content is generally filmed in 4x3 and 16x9 aspect ratios, while movies tend to be 16x9 or 2.35x1. TV and computer monitors are generally 4x3 or 16x9. Another popular screen size (especially on laptops) is 16x10.

I remember renting movies and watching them on VHS tapes. Just before the movie would start, you would see a friendly message on the screen stating "This film has been modified from it's original version. It has been formatted to fit this screen."

I never used to understand what it meant (though I also used to think the quick FBI warnings said "If you watch this tape backwards you will lose your memory") until my brother explained to me one time that "it means you won't get those stupid black bars on the top and bottom".

Later on, we began to rent more and move movies which had the so called "stupid black bars", and every shot, someone would complain about it at the beginning of the movie.

Usually however, once the movie began you didn't notice it as much, but that still didn't mean we liked it. In the early 2000's, the switch was made to DVD's which often, nicely, provided both "wide screen" and "full screen" versions, the wide screen usually referring to a 16x9 aspect ratio, and the full screen referring to 4x3. My Dad used to say that "wide screen" should be called "narrow screen" since half of it was missing. Some DVD's would even have both versions on the same screen, allowing you to choose on the disc. Eventually (around 2006 and much to my dismay) I believe DVD's stopped coming in both formats and came in wide screen only. And, 16x9 was rare, most DVD's were now only available in their native, filmed format of 2.35x1.

This meant that if you had a 4x3 TV, 2.35:1 wasn't just wide screen, it was really wide screen. You needed to upgrade your TV to a 16x9 model, just to lessen (but not remove) the letter boxing. When we had 4:3 TV's, you had to deal with 16x9 letter boxing, and when we got 16x9 TV's, you had to deal with 2.35:1 letter boxing! It's a no win situation, and getting worse with the advent of HDTV's (1080p/i is 16x9 in case you are wondering).

Now, not everyone (unlike my family members) hates letter boxing. Some argue that they prefer to see the movie as it was shown in theaters, as the director intended it, for artistic reasons. They argue that it's actually the cropping that cuts out "half the movie", and not watching it in "wide screen".

That's fine and dandy, if they want to watch the movie that way, let them. But personally, I believe in giving people the choice of aspect ratio they'd like to watch the movie in. And I think the solution to this is much simpler then you might think.

Solving letter boxing

It might seem like the only way to avoid letter boxing would be with some sort of projector, or having a TV of every possible ratio! But there are other solutions.

Many TV's now have the ability to "scale" the image. That is, they take the 2.35x1 image and stretch it to take up all of the 16x9 screen (or same with the 2.35x1 on a 4x3 screen). Personally, I don't like this option, as much as I dislike letter boxing, I dislike even more seeing the movie distorted:

Another option is cropping. Often, your player will have the ability to "zoom" in on the image. This can work to some success, but the problem here is that sometimes you cut out important things on the screen.

Some DVD's player support a "pan and scan" option which allows you to actually sweep across the entire image as it's playing, but I don't really want to have to manually control this while watching a movie either.

Couldn't we simply get them to agree?

Fat chance. There are multiple motivations for choosing an aspect ratio for a program or film, both artistic and financial. It's highly unlikely that we'll ever see an agreed upon aspect ratio for all video content. In addition, it's impractical to produce a different physical version for every aspect ratio. And even then, if you had the 4x3 version but decided later to get a 16x9 TV, suddenly your 4x3 version is obsolete.

And why should we? We're asking for the freedom to watch in the aspect ratio we wish. The creators, really, should be allowed to produce in any aspect ratio we wish. So how do we find common ground?

The solution is actually surprisingly simple, and, it's entirely software based. All we need to do is provide one copy of the video content, in whatever aspect ratio the creator wishes. Then, we use an automatic (on the fly) combination of zooming and scaling to nicely format the image into the desired aspect ratio to watch.

For example, let's say I'm watching a 2.35:1 movie on my 4:3 TV. Along with the single video file would be a text file that mapped what part of the image should be displayed at what time to my aspect ratio. For example, from 5:34 to 6:02 in the movie, the top left of the 4:3 "view window" should be 100 pixels down and 43 pixels over, then from 6:02 to 6:40, it should be 300 pixels over and 90 pixels down.

It's like the zoom method mentioned above, but instead of the entire film being zoomed onto the same spot within the larger image, the player would read from the text file and move zoomed section around the movie, seamlessly (e.g. during pans or transitions) to keep the most relevant sections in frame. Further more, this text file could be easily set up like a table, to have different mappings on my 16x9 TV for the exact same 2.35:1 source film (or have a different file for a different aspect ratio). In some extreme cases, we could also use scaling on parts of the image, but then add it with the zooming to prevent distortion.

Would be this be a lot of work to add to video content? I don't believe so, certainly no more work then doing a "full conversion" for a different aspect ratio like what used to be done. This is essentially the same thing as that conversion, the difference being in the old method the various "crops" were cut together to make a new version of the movie, since the electronics from the older analog display methods (VHS for example) weren't sophisticated enough for this. But with the age of digital media, this is entirely possible. The player merely needs to be updated to read from these cropping files and display the correct part of the source image.

And, as long as the protocol was open and usable by anyone, this could be a community driven effort. It only takes one person a little bit of time to cut their movie from the source into the aspect ratio of their choice, then publish it for others to use. Then, the next person searches a database for the "crop" file for their movie in their aspect ratio, feeds it to their player and watches away. Don't like the cropping decisions they made? Make your own, if you wish, then publish it for others to use. People could rate them and leave comments, which could ultimately result in a final "best" copy. Or, you can easily hit a button and, like magic, the original, non cropped version will play.

In fact, the cropping process itself might even be able to be automated with software (though I still like the idea of being able to do it yourself in case you don't like the decisions the software makes)

So there you go, a nice, laid out solution to matching aspect ratios between source images and display devices! No more letter boxing necessary. Will studios/equipment manufactures pick up on this idea? Perhaps not...but we can dream. It's certainly not an unsolvable problem, alas, for the time being we'll just have to muddle along.

Tuesday, December 7, 2010

Building a Ubuntu HTPC - Day ????

I've made tons of progress getting my HTPC in a fully functional state, I'd stay it's at least 85% done of the functionality I want. I just haven't been updating the blog...well these things happen :)


1. Sound "crackle" problems are now fixed. Turns out, when you modprobe the cx18 driver, you can select the tuner type. My HVR-1600 was a Phillips tuner of type 43. It had been just using some "default" tuner type which wasn't reading the audio input correctly. This also fixed ivtv-tune not being able to get high signal strength or pick up channels.

In short:

1. Create a file in "/etc/modprobe.d" called "cx18.conf" (as root)
2. Add the following line: options cx18 tuner=43 radio=0 (your tuner # may be different)
3. Save the file and restart. The module should now be loaded with the correct options and the cracking should be gone for good.


2. Lirc: Lirc support is now fully functional, both blaster and receiver. You have to put your own lirc from source, and modprobe the kernel driver, but it should work fine.

The main recipe I got to work is here:

Don't forget to modprobe the driver! You can add it to /etc/modules in Ubuntu 10.04 to have it load on boot.

Additional References you may find helpful:

I had some trouble at first getting the remote to work with MythTV. Make sure your lirc socket (e.g. /dev/lirc0) has a+rw permissions (e.g. chmod a+rw /dev/lirc0)

In addition, if you follow the instructions above, the lirc socket you connect will *not* be /dev/lirc0, but rather /var/run/lirc/lircd. This is what you must configure MythTV to connect to in order to get it to work. You can find a sample .lircrc file for MythTV here, and modify it to your needs. One thing I did is make an entry to start MythTV with the Go button:

button = Go
prog = irexec
repeat = 0
config = "/home/jason/Scripts/startmyth"

The contents of my startmyth script:

# Run MythTV front end on display 1
export DISPLAY=:0.1

You can use the DISPLAY variable to decide what X-session you want MythTV to start if you use a Dual-Head setup, like me.

Also, you'll want to start the lircd daemon on start. Here's my start lirc script:

mkdir /var/run/lirc
/home/jason/Development/lirc-0.8.6/build/sbin/lircd --device=/dev/lirc0 --logfile=/home/jason/Development/lirc-0.8.6/build/lircd.log
chmod a+rw /dev/lirc0

To run as root on boot, add it to your /etc/init.d/rc.local

3. I've cleaned up the video output a bit. Using a longer, single cable has helped but there's still a bit of interference.

4. I'm working on getting a custom Start up and Shut down program working. I've done some tests with ACPI_Wake and hit seems to work, just nailing down the details with the mythtv database, similarly, I also working on a shutdown application to turn off the computer at points after recording. I should be posing back after I get them running!