Step 1: Open the file

The first step in any Quicktime operation is to open the file. Include the Quicktime header:

#include <quicktime.h>

create a quicktime pointer:

quicktime_t *file;

and open the file in read or write mode. The following code opens a file in read only:

file = quicktime_open("test.mov", 1, 0));

Argument 1 is the path to a file. Argument 2 is a flag for read access. Argument 3 is a flag for write access. You can specify read or write access by setting these flags. Never specify read and write.

quicktime_open returns a NULL if the file couldn't be opened or the format couldn't be recognized. Now you can do all sorts of operations on the file.

When you're done using the file, call

quicktime_close(quicktime_t *file);

NOTE FOR AVI FILES:

In read mode call quicktime_is_avi to see if the file is AVI.

The procedure for writing an AVI file is described in writing.