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
- Movie level - if there's little change between one frame and the next (and that's usually the case) one can make huge savings by storing the differences between frames rather than the frames themselves. This is also known as inter-frame or temporal compression
- Frame level - a frame can be compressed using the same methods as used for still photos (using JPEG for example). This is known as intra-frame or spatial compression.
- File level - regardless of whether a file contains a movie, it can be compressed using techniques that look for repeated patterns
- Sound - many established formats for sound already exist. Can they be used alongside newer video formats?
- Proprietary formats - for commercial reasons companies might want to keep the details of their formats secret. It may be sensible to avoid using ones that are proprietary for material that needs to be viewable on multiple platforms
- Streaming - on the web you may well want to view a movie before it's fully downloaded. This requires extra controls to reduce the start-up delay and the risk of pauses due to lack of data.
- Speed - you want files to be small, but you don't want to lose too much quality, and you want the files to be quickly decompressible.
- Browser/player support - the software used to play movie files are normally called movie players or movie viewers. Some movie players will run several of these different movie formats but as yet not one will run all of them. Sometimes the movie player license requires each user to download their own copy (i.e. it can't be pre-installed centrally). Some proprietory formats might require special viewer software. It's tempting to believe that if you test your movie successfully with standard Windows' Internet Explorer, then you've finished testing, but there are other types of machines, and other browsers.
- Flexibility and Quality - some formats might be good at dealing with hi-res images but are poor at dealing with low-bandwidth lo-res images that mobiles require.
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.
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-1 is the original video format used mainly in CD-ROMs and Video CDs, provides an optimal resolution of 352x240 pixels at 30 fps (frames per second) with 24-bit colour and CD-quality sound.
- MPEG-2 is capable of supporting broadcast-quality video over high-speed connections with superior resolution to VHS. The majority of broadcast TV applications, known as DVB (Digital Video Broadcasting), use MPEG-2. It's also used in DVD movies and supports resolutions of 720x480 and 1280x720 pixels at 60 fps. MPEG-2 is 'backwards-compatible' with MPEG-1, i.e. MPEG-2 players are capable of playing MPEG-1 streams.
- MPEG-3 (for HDTV specification) was previously under development but its specifications were found to be covered by MPEG-2.
- MPEG-4 is a developing standard based on the QuickTime file format (discussed below) intended to support lower quality video over modem-speed (up to 56Kbs) data connections, e.g. video telephony.
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)
- Strengths: MPEG provides a open, standard format for video (and audio) data compression capable of producing high-quality video at smaller file sizes than comparable video formats. The CPUs in most modern desktop PCs are easily capable of decompressing an MPEG-2 coded data stream. The H.264/Mpeg4 combination is non-proprietary, efficient, and supported by all the main viewers (QuickTime viewer, Flash viewers, etc).
- Weaknesses: Lossy intraframe compression in MPEG means that the data removed cannot be recovered. Native MPEG support is present only in the latest version of Web browsers. For non-supported browsers, MPEGs have to be played through an external helper application or plug-in.
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).
- Strengths: AVI is the most popular format for audio/video data on the PC and is widely supported in the Windows platform.
- Weaknesses: Although AVI can be played on other platforms, it is generally perceived as a Windows-only format - and a proprietary Microsoft one at that. AVI is of relatively low quality (when compared to MPEG-1, for example) with a limiting frame rate and mono sound. Problems with syncing up audio and video?
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.
- Strengths: QuickTime allows the integration of text, graphics, video, animation, 3D, VR and sound into one file. Its component architecture makes it extensible. ISO's decision to base the new MPEG-4 standard on QuickTime will provide added support for an already popular format.
- Weaknesses: An external (free) plug-in is required to view QuickTime files in Netscape Navigator and Microsoft Internet Explorer on Macintosh and Windows platforms. There is no plug-in support for non-Apple Unix.
RealVideo is a proprietary video standard developed by the RealNetworks software company. The format is a streaming technology,
- Strengths: RealVideo is a well established format, with a large user base. The latest playing software allows the user to fine tune the video in real time and has support for third-party and standard data types such as QuickTime, AVI, WAV, MIDI, MPEG and JPEG.
- Weaknesses: RealVideo files require RealServer server software (a basic version is free) to handle the outgoing streams of packets and RealPlayer software to receive and play the data on the client machine. RealServer is available in Unix and Windows, but not for the Macintosh platform. RealVideo files are used by the BBC.
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.
- Strengths: Most browsers have the flash plugin installed nowadays (though currently (June 2009) there are a lot of machines that will not accept Flash8/9, and iPods don't like Flash). Files are small.
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 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 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!
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.
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 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
- DivX (proprietary software), "the MP3 of video," is the popular and market-leading MPEG-4 video codec that is emerging as the standard for full screen, full motion, DVD-quality video over IP-based networks.
- Xvid is a free alternative to DivX
- Sorenson video
- Motion JPEG - JPEG compression is used on each frame. This comes in various forms. MJPEG-A is an attempt at standardisation supported in QuickTime
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
|video/mpeg||mpeg mpg mpe|
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.
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:
- Audio Codecs
- Microsoft Pulse Code Modulation (PCM)
- Microsoft GSM 6.10 Audio (GSM 610)
- Microsoft CCITT G.711 A-Law and u-Law
- Microsoft Adaptive Differential Pulse Code Modulation (MS ADPCM)
- Interactive Multimedia Association Adaptive Differential Pulse Code Modulation (IMA ADPCM)
- Microsoft MPEG-1 Layer 1; Microsoft MPEG-1 Layer 2
- Windows Media Audio (WMA) v2, v7, v8, v9 (including Windows Media Audio 9 Voice). Note Windows Media Audio v9 is supported in Windows CE .NET version 4.2 and later.
- Fraunhofer MPEG-1 Layer 3 (MP3)
- Video codecs
- Microsoft MPEG-1 (MS MPEG-1)
- Microsoft RLE8
- Microsoft MPEG-4 v2, v3, ISO v1
- Windows Media Video (WMV) v7, v8, v9 (including Windows Media Video 9 Image). Note Windows Media Video v9 is supported in Windows CE .NET version 4.2 and later.
In addition, the following content formats (and their associated file name extensions) are supported:
- Audio streaming formats
- MPEG standard 1, Layer 1,2, 3 (.mpa, .mp2, .mp3)
- Windows Media Audio (.wma)
- Video streaming formats
- MPEG standard 1 (.mpg, .mpeg, .mpv, .mpe)
- Advanced Streaming Format (.asf)
- Windows Media Video Format (.wmv)
- Advanced Stream Redirector (.asx)
- Windows Media Audio Redirector (.wax)
- Windows Media Video Redirector (.wvx)
- Windows Media Redirector (.wmx)
- Non-streaming (local playback) audio formats
- Waveform Audio (.wav)
- Sound File (.snd)
- UNIX audio (.au)
- Audio Interchange File Format (.aif, .aiff, .aifc)
- Non-streaming (local playback) video formats
- Audio-Video Interleaved (.avi)
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 supported formats are listed online at Apple's site.
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 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 is a free program that uses the ffmpeg libraries.
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.
- Checking with your department's A/V section
- Using a high-street store (it costs about £20 for 2 hours)
- Using one of the newer DV cameras (which have a "Analog-to-Digital Pass Through Conversion" feature) between the VCR and the computer
- Using a video capture board
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.
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
- DGMPGDec - a decoder suite that can be used on DVD VOBs
- Yade X (Yet Another Dvd Extractor, for Macs)
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
- Frame Size - there's no point producing a full-screen version if the clip's only going to be played in a little box on a web page. Standard DV frame size is 720x576 pixels. Keep the aspect ratio if you reduce the size. Better still, use powers of 2 - 360x288 or 180x144.
- Data Rate - if users are using 56k modems then even a 36k data rate is optimistic. If you compress using VBR (variable bit rate) the movie will be analysed to determine where a higher bit-rate will be beneficial. Home DVD films (using MPEG-2) use VBR. This process takes longer than CBR (constant bit rate) compression.
- Frame Rate - >12 may lead to choppiness on the WWW
- Key Frame Rate - how many of the frames are stored in their entirety - 1 in 10 is high quality. Some compression formats sometimes extrapolate between frames to produce intermediate frames (rather than store differences)
- Sound Compression
- Colors (or Depth) - sometimes one can choose between "millions" or "thousands" of colors. The difference might be negligible to the human eye, but file sizes will differ
- Quality - this can refer to several features. Often it refers to how each frame is compressed. JPEG is a "lossy" compression method - quality can be sacrificed to reduce file size. The amount of loss can be set.
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 (letting the user start to view the movie before the whole movie file has been received) can be done in 2 ways
- HTTP streaming - the whole file is copied over (and often remains on the user's machine). The movie player can start showing the movie when enough has been received. The Player can sometimes be helped if the movie file is saved with this sort of streaming (or "progressive downloading") in mind (QuickTime Pro has a "Fast Start" saving option, for example). HTTP is the usual WWW protocol, so a special web server isn't needed. For short (2 minute?) clips that aren't heavily used, this is a reasonable option.
- RTSP streaming - no file is stored on the user's machine. To deliver in this fashion (using the Real Time Streaming Protocol) requires a special web server. This kind of streaming is necessary for live video broadcasts, and so that the viewers can skip around the video.
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.
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.
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.
- QuickTime - See Apple's Web badge trademark license page before adding something like the following
to your document.
QuickTime and the QuickTime Logo are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. The Get QuickTime Badge is a trademark of Apple Computer Inc., used with permission.
- Windows Media Player - See Microsoft's
Windows Media Player Download Button Logo
and Guidelines page before adding something like the following
to your document.
- RealPlayer - See RealNetworks Logos page before adding something like the following to your document.
- Macromedia Players - See Macromedia's Download Macromedia Web Player Buttons page to see how to use
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"
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.
<object data="video.avi" standby="video loading ...">|
<object data="still.gif" type="image/gif">
Neither video nor still can be displayed
Even new browsers vary in how well they cope with this feature. A link to a video file is safer.
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
- Linux-based Teaching System - Firefox is installed, along with vlc and xamin. AVI, MPEG-4 and QuickTime files are all identified, but only (some) AVI files are played.
- Windows-based Teaching System - (the EIETL machines, the twn cluster in the DPO) - Internet Explorer is installed, which can run AVI movies within the browser. MPEG-4 and QuickTime files aren't run.
- Windows-based Admin System - (on admin office machines)
- Lecture Theatre Machines - Internet Explorer is installed. The LT0 machine has RealPlayer and QuickTime Player. It uses RealPlayer to play MPEG-4s, Windows Media Player to run AVIs, and a QuickTime plugin to play QuickTime movies.
- Dr Hugh Hunt's Movie Page (CUED)
- deployable structures movies (CUED - various formats)
- Local test samples (warning: this page uses features that can easily crash browsers)
- Movies from the University's Planning and Building page.
- Sorenson Squeeze
- Discreet Cleaner (produces Real, Window media, QuickTime)
- ffmpeg - a free command-line converter using the same libraries as ffmpegX (for MacOSX) and winff (for Windows and linux), etc. It's installed on CUED's main system. Type ffmpeg -formats for a list of supported formats/codecs.
- MPEG Streamclip (Mac, Windows). Free. Plays, edits, and batch-converts a wide variety of formats.
- HandBrake (Mac, Windows, Unix). Free. Supports batching. Supports any DVD-like source and most multimedia files. Outputs include MP4, MKV, AVI or OGM; MPEG-4, H.264, or Theora.
These can be used for converting as well as editing
- Premiere Pro
- Final Cut Pro
- Windows Movie Maker
- Cinelerra (in the process of being changed to 'Lumiera')
- SMIL (W3C's "Synchronized Multimedia Integration Language")
- HTML5 includes support for movies, so browsers won't need plug-ins. Some
browsers (e.g. Firefox 3.5+) already offer some support. The following code
<video src="http://v2v.cc/~j/theora_testsuite/320x240.ogg" controls> Your browser does not support the <code>video</code> element. </video>might work for you. For further details, see HTML5
- CUED's Audio Visual Services (Video tape system conversion, video recordings can be converted to playback on all world systems)
- CARET's Video services (university people can access the CamTools "Video" site)
- The University's Streaming Media Service started officially in October 2008. You submit a DV file and choose the formats that you'd like. A typical range of formats/quality is flv (medium quality stream) ipod(high quality dl) mov (medium quality stream) mov(small quality dl) rm (high quality stream) swf (medium quality embed) wmv(medium quality dl) wmv (medium quality stream) which should satisfy most demands. Note however that access control isn't very flexible.
- Note that some local videos are now available via iTunesU