Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  Computing help >  graphics

Online Videos

The focus is mostly on video (rather than computer animation) delivered via the WWW
TheoryPractise

Introduction

Putting a movie online isn't hard. However, making sure that it's viewable in a satisfactory way by as many people as possible usually requires more work.

Saving every pixel of every frame in a movie would require a huge amount of memory/bandwidth (about 1.6G/minute). Various approaches have been used to reduce this load so that a typical 1 minute trailer (480x272 pixels, 24 frames/sec, stereo sound) uses 11M. These techniques work at various levels

Typically, movie formats use all these techniques. Other factors complicate the issue further For all the reasons (and more), a wide (even bewildering) range of solution has emerged. If you want to know more about these options, read on. If you just want to get on with things, jump to the Preparing Files section.

Format Options

MPEG

MPEG is named after the Motion Picture Experts Group, a committee organised in 1988 by the ISO to develop international standards and file formats for video compression. MPEG has produced a number of related standards. Each standard comes in various varieties classified as profiles (list of features) and levels (parameters - frame size, etc). MPEG-2 files for example are commonly MP@ML ("Main Profile at Main Level"). An MPEG-4 file might be SP@L1 ("Simple Profile, level 1"). MPEG incorporates the same intra-frame coding as JPEG for each frame. This technique - in combination with interframe coding - allows for optimal compression of video data. The interframe compression uses a technique called DCT (Discrete Cosine Transform) to encode only the changes between periodic key frames. MPEG files can be decoded by special motherboard hardware or by software. Because it's free, standard and useful it's the basis for many "codecs" (see later)

AVI (*.avi)

AVI (Audio Video Interleave) is a format developed by Microsoft for Windows. It interleaves audio and video data to provide 8-bit colour depth animation of 160x120 pixel resolution (15 fps) and audio at 11,025Hz in 8-bit samples. An AVI file plays on a PC via an application capable of parsing the AVI file header and consecutively pulling in the video frame and accompanying audio. The video is then decompressed and displayed in sequence with the audio sample which has been sent to the soundcard for output. AVI is a specialisation of the RIFF (Resource Interchange File Format).

WMV (*.wmv)

WMV (Windows Media Video) is a general name for the proprietary streaming video technologies developed by Microsoft. wmv files are usually put in Advanced Streaming Format (ASF) containers (suffix .wmv or .asf) though they can be stored in AVI or Matroska containers (suffices .avi and .mkv). It uses some of the latest compression methods to produce small, fast files.

QuickTime (*.mov, *.qt)

QuickTime is a standard created by Apple Computers. Although the format was originally developed for the Macintosh platform, the abundance of high-quality QuickTime movies has made it popular with PC users. QuickTime is a highly flexible format capable of storing a wide variety of data: from multiple videos and audio tracks to single photographs. Its flexibility extends to, for example, allowing for the inclusion of several user-selectable audio tracks to accompany a QuickTime movie. It supports most encoding formats, including JPEG and MPEG. QuickTime3 also enables the creating and viewing of virtual reality and 3D graphics. Players for QuickTime multimedia are freely available for the Macintosh, Windows 3.1, and Windows 95/98/NT/ME/2000/XP from Apple. For the Macintosh, a freeware program Sparkle can be used to play both MPEG and QuickTime movies, and can also be used to convert between the two formats. The latest QuickTime 6.5 supports AAC (the new standard in professional audio), Pixlet ("the first studio-grade codec for filmmakers") and 3GPP/3GPP2, for multimedia over new, high-speed wireless networks.

RealVideo (*.rv)

RealVideo is a proprietary video standard developed by the RealNetworks software company. The format is a streaming technology,

Shockwave (*.swf)

The Flash and Director programs from Adobe produces animation files that are exported as movies in the Shockwave ("swiff") format. Flash is used by YouTube.

FLV (*.flv)

FLV (Flash Video) is a proprietary format used by YouTube, MySpace, etc. The Adobe Flash Player can play such files, so can vlc. A Flash Video file can be a separated FLV file or a video stream in a Shockwave file. It's not supported on iPods or iPads.

Flic

FLIC or FLI Animation file formats are generally used by DOS applications that were created by Autodesk and their software. This file format was one the first to be created that can be used for animations.

Ogg

Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs (vorbis,theora etc). It's an open format free for anyone to use - Wikimedia and Grand Auto Theft use it!

Animated Gif

These are a development of static GIFs as used on WWW pages. Their use is mainly restricted to short, small web-embedded animation clips. Programs like Macromedia's "Fireworks" can produce them. See our Producing animated gifs with GIMP page for local details.

Extensions

There are variations on the formats above. Several common cameras produce "Motion JPEG OpenDML" files. OpenDML is an extension to the AVI file format and Motion-JPEG DIB definition in order to improve the file format for playback purposes. These file format extensions were adopted by Microsoft and others.

Codecs

Codecs are programs for COmpressing and DECompressing data. In contrast to audio and image formats, most video file formats allow a variety of codecs, both audio and video, to be used. Auxiliary information often includes subtitles and the data required for correct synchronization between audio and video.

Note that a codec is a program that codes or decodes files in particular formats. A codec isn't a format - a codec called "XXX" might not produce files in the "XXX" format, and even if it does, another codec might be able to decode the file. "DivX" for example is a commercial codec that deals with "MPEG-4 ASP video" files (though they're commonly called "DivX files"). "Xvid" is an open-source codec that also deals with "MPEG-4 ASP video" files. Neither "DivX" nor "Xvid" are formats.

A four-character code ("FourCC") at beginning of media files indicates what codec your system should use for decoding the file (though others might work too). E.g. once you know that the FourCC of a file is "DIVX" you can find out that the format's used for versions 4.0 and later of the DivX codec. When converting a video there's usually a choice of codecs. Here are a few

Players

Content types

When a web server sends a file out it includes a header indicating the type of file. If the server you use is correctly set up your files will be transmitted with the right "content type" in the header as long as the filename extension is right. The following table lists some MIME content-types currently in use on the Web
MIME content-typesuffix
video/mpeg mpeg mpg mpe
video/mpeg-2 mpv2 mp2v
video/quicktime qt mov
video/x-msvideo avi
video/dvd dvd

When a movie file is received by a web browser, the browser needs to identify what type of file it is so that it can be displayed appropriately. The identification can be done in various ways (by looking at the first few bytes of the file, by looking at the filename extension, by looking at the content-type, etc). Different browsers have different strategies, though using the content-type is the prefered option.

On knowing the content-type the browser can then use the appropriate movie player. If the choice of appropriate player isn't configured by default the user may have to manually configure. If users report that they can't see your movie, their browser configuration is one thing to check.

Note that Internet Explorer doesn't always respect content-types. IE6 on Windows XP, Service Pack 2 introduced a new setting under Tools->Internet Options->Security settings where users can choose to "Disable Open files based on content, not file extension" or otherwise.

Windows Media Player

The Windows Media Player control acts as a universal player for rendering most standard multimedia formats. This includes stored and live content in network audio and video formats. Codecs supported typically include the following:

In addition, the following content formats (and their associated file name extensions) are supported:

Note that Microsoft removed the IV50 codec in the XP SP2 upgrade, and that they now point you in the direction of a company called Ligos who produce a commercial codec (that even now is documented as not working properly under SP2). The files can be displayed using Real Player instead of Windows Media Player, but it's better to convert the AVI files using something like the Allok AVI MPEG Converter.

MPEG-4 was supported prior to version 9.

QuickTime Player

QuickTime supported formats are listed online at Apple's site.

iTunes

Tunes 8 can currently read, write, and convert between MP3, AIFF, WAV, MPEG-4, AAC, and Apple Lossless. iTunes can also play any audio files that QuickTime can play (as well as some video formats), including Protected AAC files from the iTunes Store and Audible.com audio books. There is limited support for Vorbis and FLAC enclosed in an Ogg container. iStore videos are Protected MPEG-4 video (H.264) with a minimum 128 kbit/s AAC audio track.

vlc

vlc is installed on the DPO terminals. It supports MPEG-1, MPEG-2, MPEG-4, DivX, mp3, as well as DVDs, VCDs, and various streaming protocols.

ffplay

ffplay is a free program that uses the ffmpeg libraries.

xanim

xanim (a cross-platform unix video viewer), has a mechanism for handling binary-only plugins. It's also installed on the DPO terminals. It can deal with some formats that vlc can't.

Preparing Files

From old video to computer

Options include

From digital video to computer

This is usually just a matter of plugging the camera in - some systems auto-detect, starting the right software on the computer. Make sure you have enough disk space spare.

From DVD to other formats

A standard DVD movie disc has a folder called VIDEO_TS containing *.VOB, *.BUP and *.IFO files. The *.BUP files are backups, the *.IFO files contain information about chapters, subtitles, etc. The *.VOB (Video OBject) files contain the video (MPEG-2), audio (normally AC3 Dolby format) and subtitle information (see Videohelp.com's page for DVD File/Folder Structure details). Not all movie-editing programs can cope with *.VOB files, so you may need to convert first - though note that commercial DVD are encrypted.

Amongst the free dvd extractors are

Converting between computer formats

Unless you saved a file with web-delivery in mind, your file is likely to be too big or in an inappropriate format. If you have already created a movie file and are wondering if it will be ok on the WWW, you first need to know what format it's in. The filename suffix provides a clue, but you need more detailed information. Knowing that a file is in AVI format isn't enough - many codecs could be used. The movie player you use should be able to help - for example the video data format might be described as "Motion JPEG OpenDML". On a Windows machine to find out what an .avi file is compressed with, right-click the file, then click details, then look at "Video Format" and this will tell you what codec you need to view the movie. With the QuickTime viewer you can click on "Get Movie Properties". The Video "Data Format" usually tells you the compression method used (though sometimes it tells you the file format - e.g. "GIF")

The easiest way to prepare a file for use on the WWW is to use a movie editor (e.g. iMovie on Macs). The "Export"/"Save As"/"Publish" option of Movie Editors leads to Panels of choices. The compressor ("MPEG-4 video", "Sorenson Video 3", "H.263", etc) can be chosen which in turn will influence what other options (surround-sound, etc) might be offered. Issues to decide upon include

Sometimes users are provided with a few general options that set these above properties for you, though you can generally over-ride the default settings. iMovie for example offers "Email", "Web", "Web streaming", "CDrom" and "Full Quality DV" settings.

Streaming movies

Streaming (letting the user start to view the movie before the whole movie file has been received) can be done in 2 ways

The client is expected to download helper applications that can read the compression type that the server software is sending. These are usually given away free to encourage a large user base. The server software is usually pretty expensive for full versions. Darwin/QuickTime streaming servers support hinting using the RTSP.

The BBC (see their Audio/Video help page) tend to use RealMovie. Movie trailers tend to be Quicktime.

From matlab to movies

You can create AVI files in matlab by using the movie2avi function. On Unix you have no choice for compression. On Windows the default is Indeo3 though Cinepak is also available. movietogif is installed on CUED's Teaching System - it converts movies to animated GIFs (see an example). mpgwrite translates a MATLAB movie into an MPEG file on some systems, but not ours.

Web pages

On the web page that provides access to your movie you should warn users about the size and format of the movie file (offering a choice of formats and resolutions if possible), and help users obtain the necessary player.

Some browsers/formats/customisations let you embed the video in the page rather than having a link to the "stand-alone" video. With Apple's Safari browser, something like this works

<embed src="FXCD0107.avi" width="320" height="255"
autoplay="true" controller="true" loop="true"
pluginspage='http://www.apple.com/quicktime/download/'> </embed>

The options give you control over whether the video plays immediately, whether the video-player controls are shown, etc. However, the embed tag isn't standard.

CIT's Embedded Media HTML Generator asks some questions then produces code specific to your needs, but to handle the general case tidily you may need to use JavaScript. Alternatively you can try the more general object tag (understood by newer browsers). If the following code is read by browser that can show AVI videos, it will display "video loading ..." until the file's loaded. Otherwise it will try to display the gif file. If it can't do that, the final message will be displayed.

<object data="video.avi" standby="video loading ...">
 <object data="still.gif" type="image/gif">
   Neither video nor still can be displayed
 </object>
</object>
Even new browsers vary in how well they cope with this feature. A link to a video file is safer.

Local set-ups

In most cases the file you produce for external users will also be best for local users - some of whom may be using modems and besides, even within the department there's a variety of platforms. We are evolving towards a situation where there are a few "standard" configurations. You should at least check that your files work on these

Examples

References

Players

Converters

Movie Editors

These can be used for converting as well as editing

Formats and Codecs

The Future

Local facilities

© Cambridge University Engineering Dept
Information provided by Tim Love (tpl), jpmg, pjgl2 and hemh
Last updated: June 2010
Valid XHTML 1.0 Transitional