Table of Contents > Understanding Video in JES
Understanding Video in JES

Video on computers is usually much like video on television or at the movies. In JES, we create movies the in the same way that animators do. To find out more about movies, read the Movies section of your textbook.

Frames in Movies

A movie only creates the illusion of movement. Video is, in fact, made up of a sequence of still images flashed quickly one after another. We call these still images "frames." When you see these frames at a certain speed, your brain interpolates the movement between them and you get the illusion of movement. Film movies are played at 24 frames per second. This means that every second, the still image you are looking at changes 24 times. US television is played at 30 frames per second, and European television is played at 25 frames per second.

jump to top

Storing Movies on your Computer

Since video is just a sequence of images, it would make sense to store it like this on your computer. This is what JES does. When you make a movie with JES, it creates a "Quicktime" movie of your frames. You give JES a list of frames you want written out to a file, and JES make the quicktime movie. This movie is just the series of frames bundled with a description of how to play them back (speed, size, audio, etc.). Of course, if you wanted to store long movies like this, you might get into some trouble.

Let's say that you wanted to store a two hour movie on your computer from JES. You want the image to be fairly large and good quality, so you create JPEGs about 250,000 bytes (250 kilobytes) in size. For each second of video with 24 frames you'll need 6,000,000 bytes (6 megabytes). For each minute, you'll need 360 megabytes of space and for the entire two hour movie, you'll need 43 gigabytes! That's pretty large, considering a DVD only holds about 9 gigabytes.

So, how does my copy of Blazing Saddles fit on a DVD? Well, remember that JPEGs are really "compressed" images. If information is redundant, is not needed, or can be predicted we don't have to store it. The same works with video. If there's a big block of black in the lower left hand corner for 3 seconds, why bother storing the same information 72 times? This is part of how video compression works. The video format on DVDs is MPEG (specifically, MPEG-2). It reduces the size of video dramatically by using motion prediction and lots of other math tricks.

There are lots of different kinds of video formats out there, and JES will play many of them. Open them up in JES or your favorite movie viewer and try to tell the difference!

jump to top

JES Movie Functions

JES has the ability to create quicktime movies and play back lots of different movies. To get playback to work, make sure that you have installed Quicktime for Java. Instructions are on the JES Installation page.

makeMovieFromPictures makeMovieFromPictures(frames, path, framerate):
frames: a list of pictures to write out as frames of the movie
path: the path to the file where you want the movie written
framerate: OPTIONAL the framerate in frames per second you want the movie to play. If not given, it will default to 30.
Takes a list of frames and writes them out to a quicktime movie. Make sure that the file you write out to ends in ".mov". The movie will be created from the frames in order by index from the first to last. The speed of the movie may be specified or default to 30.
openMovie openMovie(filename):
filename: the path to the movie you wish to open in the player
Opens the movie at the given path into a movie player.
jump to top