Video sizes for upload and playback

Book page

When uploading files for playback on the web, you always have to find some compromise between quality and reasonable download speed. Simply, the bigger and better the file you want, the longer most users will have to wait just to see it. YouTube has found their sweet spot for web users, but does so by squashing image quality to the bare minimum. If you want original video uploads to look better than YouTube, you can choose to do so, but you still have to find the right compromise.

Connection speeds and limitations

Telecom 'Jetstream' offers 128kbs maximum under good conditions.

At that rate, an uncompressed 26Mb file is calculated to take 25 minutes to load 2 mins of playtime!

An upgraded Telecom account may offer a max 256kbs under perfect conditions. That's still 12 minutes of waiting for 2 min playback, a slow, slow 6:1 ratio.

The actual speed available depends on many factors, including other traffic on the server.

Youtube manages a 1:1, or at least 2:1 viewing ratio. That's what internet users have come to expect, even granted the abysmal picture quality.

To enable our website videos to play in good time, we should aim at no more than a 2:1 ratio. 2 minutes of waiting time per 1 minute of playback, over a domestic or wireless connection. Faster connections will get realtime playback.

For best playback results under these conditions, we should expect 1 minute of film to be compressed into 3 Mb of file. 6Mb for two minutes of video is a good number for viewing in realtime, 1:1 speed.

But for higher playback quality, or larger display size, larger, slower file sizes must be considered. If we are prepared to endure a 2:1 wait, then a filesize of 12 MB for 2 mins is a reasonable maximum.

Working with sample video, it seems that for the output size of 640x360, an encoding bitrate of 768bps is about right and produces a file of 11Mb . This is double the quality usually seen in a youtube default format.

 Upload

A further limitation however is a result of the file upload process. On many connections in NZ, the upload speed is throttled to 1/4 or sometimes 1/10th of the usual download speed! That means that if in good conditions this 2 minute video may play back within 4 mins, for an editor to place that video there in the first place will take 1/4 of an hour just waiting on their browser to finish. This is horrible. Any network interruption during that time can cause the update to fail, and either the server or browser may time out and drop that connection for a number of reasons. This, plus built-in limitations of the web server means it's unfeasable to upload, via a web interface, files larger than 8MB on anything less than a high-speed (1000Kbps) connection.

There are of course ways around this limitation - using FTP upload. Instructions for this are a little more complicated than just 'clicking upload' but not too hard once it's sorted.

Compression - Preparing video for the web

I've used "Riva FLV Encoder" to prepare the videos, using the presets described above. It's possible to upload Quicktime MOV files (or just about any other format) also, but for the widest, most troublefree viewing by all users on all machines, FLV (Flash Video) has become the web standard.

Obtain that software and click go. It's totally obvious to use.

Playback - the flowplayer

When using flv format, the videos are displayed using a free Flash player called Flowplayer.

This tool attempts to stream the playback by 'buffering' the file loading until enough of the file is available to progress to the end without hiccups. If loading is happening at a 2:1 ratio, that means that playback will not start at all until halfway through, because it assumes that by the time you reach halfway, the rest of the file will be available.

If, on the other hand, loading is just a little slower than the playback, the buffer may calculate that it's safe to start playback after only a few seconds playback. This maths isn't always right, and can sometimes lead to stalled video if the file is larger than predicted. The only sure-fire way to avoid this happening to people with slow connections is to defer playback altogether until the whole file is available. This however is most unfriendly, as it takes 6 minutes to watch a 2 minute clip - 4 mins to download completely, followed by the actual 2 mins of playback. This behaviour can be switched by setting the flowplayer 'autobuffering' setting.