Von Nau

YouTube file format

Saturday November 24, 2007

Update December 21 2011:

To export videos for YouTube, I recommend these settings:

  • QuickTime, H.264 video codec with AAC audio
  • Use the highest resolution and bitrate you can while still keeping the file under 2 gigabytes

If you use a Mac, the easiest way to do it is with QuickTime Player. Simply open your video and select Share > YouTube. This will give you a high quality result without having to adjust any settings. Something to keep in mind is that YouTube keeps the original files you upload, so if in the future they offer higher quality playback, your video will be “upgraded” automatically.

The rest of this page is completely out of date. It describes either the first or second generation of youtube codecs and is preserved only for its historical value.

When you upload a video to YouTube, a few things happen. First, the contrast of the video is increased and video noise is suppressed. Next, it’s resized to 320 × 240 (widescreen videos are “letterboxed” with black bars on the top and bottom). Finally, it’s compressed as a flash video file (.FLV), using the settings in the “standard” column.

standardhighvery high
file extension.flv (flash video)
total bitrate~320 kbits/sec804.7 kbits/sec2147.2 kbits/sec
audio codecMPEG layer 3 (MP3)
audio formatMono, 22.050 kHzStereo, 44.100 kHzStereo, 44.100 kHz
audio bitrate~67 kpbs/sec128 kpbs/sec128 kpbs/sec
video codecSorenson Spark (H.263)
video format320 × 240, 15-30* fps320 × 240, 29.97 fps640 × 480, 29.97 fps
video bitrate~250 kbps/sec677.7 kbps/sec2019.2 kbps/sec
*YouTube respects the framerate of the uploaded file.

To achieve higher quality, you can save your own .FLV files and upload them to YouTube. You can encode video with higher bitrates and resolution than YouTube’s standard. The only limitations on FLV’s: the file must be under 1 GB and you must use the Sorenson Spark video codec and MP3 audio codec. I’ve successfully uploaded a file with the specs in the very high column. With these settings the file takes forever to download and plays sluggishly on my computer (G4 Dual 1.0 GHz PowerMac).

I recommend the settings in the high column for a file that has noticeably higher quality than the standard YouTube compression and takes a reasonable amount of time to download. If your video doesn’t have fast motion, I’d recommend uploading the file as a QuickTime or AVI file and letting YouTube handle the FLV compression; it does a great job, better than I have been able to achieve encoding FLV’s with the same bitrate.

YouTube may have some kind of mechanism that can vary the bitrate of the clip once it is uploaded. I say this because I’ve downloaded the same clip at two different times and each one had a different video bitrate. I don’t know if it was an error, or if YouTube can adjust bitrate on the fly during peak usage, for example. The clips that I uploaded as FLV’s have not shown any variation in bitrate upon download.

Update February 7, 2007:

Here’s an example of the quality difference between the YouTube standard compression and a video compressed using Sorenson Squeeze with the settings in the high column. Thanks to Goose for sending this in.

links

http://keepvid.com – Download .FLV files from YouTube & others
http://vixy.net/flv_converter – Generates MPEG4 files from YouTube links
http://1024k.de/bookmarklets/video-bookmarklets.html – Play .FLV files on a pc
http://perian.org – Play .FLV files on a mac