Few things in life are as opaque as working with YouTube—a black box with irresistible appeal to most video producers. Trying to discern how to produce the absolute best quality has consumed boatloads of my time in the past. Recently, however, a concert event client asked me to post six videos to YouTube, and I dove in again.

The video was shot in widescreen DV for compatibility with the projection system that was used at the concert. The big question in my mind was what would be the optimal configuration for uploading to YouTube. My goals were to display a good quality video in the standard YouTube window, to select the highest quality HD/HQ option, and to choose the best quality full-screen display. The answer should be simple, but it isn't.

As you may know, YouTube has multiple playback modes-some that you can see and access and many more under the hood. In terms of playback, there's the basic video-in-the-window mode that you get when you access the site. Then there's an HQ mode that viewers can access by clicking the red HQ button on the bottom of the player. At the high end is an HD mode that's produced at 720p at about 2.3Mbps combined audio and video data rate. [Edit: At press time, YouTube announced support for 1080p videos. Not sure if I would ever use this, since relatively few monitors support full-resolution 1920-pixel playback, but wanted you to be aware that it's an option.]

I did some digging around on Google, and I found recommendations to upload at 768x432, 720x400, and 854x480. Other sites recommended upscaling SD video to 720p and uploading at that resolution. Figuring some tests were in order, I added 480x270 to the mix. Counting 640x360 resolution, this totaled six test cases. I produced a short 20-second clip to all these parameters, encoded in H.264 at 14Mbps (the highest supported by my encoding tool), and uploaded all the files to YouTube.

Then, using Firefox's Download Helper plug-in, I downloaded all the files produced by YouTube from the uploaded files. Here's what I found: As shown in Table 1, YouTube produced six different types of files from my source files, producing Original YT (YouTube) and HQ18 files and 640x360 files for all the tested configurations, except for the 480x270 upload. In addition, for the 480x270 upload, the HQ18 data rate was 415Kbps; for all others, it was 525Kbps. This eliminated 480x270 from the equation.

The highest quality file produced for the 768x432, 720x400, and 640x360 reconfigurations was the 640x360 file; there wasn’t an HQ option in the YouTube Player. As you recall, the HQ option was one of my goals because it allows playback in a larger window size and sends a subtle message to the customer (and viewer) that you know what you’re doing.

YouTube produced the HQ35 file for the 854x480 and 720p uploads and placed the HQ button in the player bar for the 854x480 file. YouTube produced the HQ22 file for the 720p upload (and not the 854x480 upload) and placed the HD button in the player bar. I compared the HQ35 and HQ22 files. The HQ22 looked much better, which meant that the 720p upload offered the best possible viewing experience.

Next, I wanted to figure out when YouTube actually used the different files, which is where things got really complicated. To determine this, I started playing the files and capturing them via RealNetworks’ RealPlayer, which captures a single file at a time—presumably the file that you’re actually playing. In contrast, Download Helper displays multiple files available from the page, and it’s tough to tell which file is actually playing at the time. The playback variables that I tested included the slow and fast connections in YouTube’s Player Options and the ability to watch in native resolution, HQ/HD, and full screen in both Firefox and Google Chrome on my office LAN, which connects via DSL.

Unfortunately, the results were all over the map. For example, with a slow connection configured in Firefox, YouTube seemed to send the lowest quality file. But in Chrome, it sent the 640x360 in that configuration when available. The only semi-reliable conclusion that I reached was that YouTube sent the HQ35 file in HQ or HD mode and the HQ22 (for 720p) or HQ35 (for 854x480) in full-screen mode.

This meant that viewers were rewarded with higher-quality files when they chose the HD/HQ or full-screen options. Since the HQ22 file was higher in quality than the HQ35 file, I produced all my files at 720p and uploaded them to the site. To view the files, find the Graham Fest 2009 channel on YouTube; to see the test files, search for Janozer and Rocky Top in the YouTube search field.

Note that to reliably access YouTube’s 720p mode, you have to upload 720p videos. Don’t upload higher resolutions because YouTube doesn’t always convert them to 720p. If you’re working with higher-resolution videos, scale to 720p manually and then upload. I always upload H.264.mov files to YouTube, using the highest data rate that I can without exceeding the 1GB upload limit.