Up: SGI movie Frequently Asked Questions (FAQ)
Next: -25- How do I write a program which can write individual frames from a movie file out to a still image file?
Previous: -23- Does anyone know the maximum size a movie file that MovieMaker or MoviePlayer can handle? Is it limited by free memory, or will it play from the hard drive?
Subject: -24- How do I write a program to access the pixels of a video
frame in a movie file for image processing purposes?
Date: Wed Nov 16 13:04:20 PST 1994
Basic overview:
You need to write the program using the Movie Library.
Open the file using mvOpenFile(3mv), get a handle to the
image track using mvFindTrackByMedium(3mv), then read the
individual image frames using mvReadFrames(3mv).
Details on the format of image data:
The following libmovie calls return information to describe
the format of the data returned by mvReadFrames():
int mvGetImageWidth ( MVid imageTrack );
int mvGetImageHeight ( MVid imageTrack );
double mvGetImageRate ( MVid imageTrack );
const char* mvGetImageCompression( MVid imageTrack );
DMinterlacing mvGetImageInterlacing( MVid imageTrack );
DMpacking mvGetImagePacking ( MVid imageTrack );
DMorientation mvGetImageOrientation( MVid imageTrack );
For interlacing, packing and orientation, the types of
formats can be found in <dm_image.h>.
Once you have the description of format for the data in the
image track, you can treat the buffer of untyped data
returned by mvReadFrames() as an array of pixels. If you
need the data in a different format for your image
processing or file I/O, you will need to perform the
conversion yourself.
For writing movies, the process works similarly. Create a
DMparams structure that describes the format of the data
you will be writing, and pass that to mvAddTrack(). This
creates an image track with the data format you want. Then
pass pixel data in that format to mvInsertFrames().
Note that the Movie Library uses the MVid data type to
represent both movies, and tracks within the movies. So
when you write a program to read or write image frames,
you will have two MVid variables - one for the movie as
a whole, and one for the image track embedded within the
movie.
Check the Digital Media Programmer's Guide and the Movie
Library Manual pages for more details, as well as detailed
instructions on how to use these calls.
Up: SGI movie Frequently Asked Questions (FAQ)
Next: -25- How do I write a program which can write individual frames from a movie file out to a still image file?
Previous: -23- Does anyone know the maximum size a movie file that MovieMaker or MoviePlayer can handle? Is it limited by free memory, or will it play from the hard drive?