public static void main(String args[]) {
    try {
      QTSession.open();
      GroupDrawing frame = new GroupDrawing("QT in Java");

      frame.pack();
      frame.show();
      frame.toFront();
    } catch (Exception e) {
      e.printStackTrace();
      QTSession.close();
    }
  }
  public void dispose() {
    if (readyForFrames) finish();

    try {
      QTSession.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /**
   * Create a movie with the specified width, height, filename, frame rate, codec type and quality,
   * and key frame rate.
   */
  public MovieMaker(
      PApplet p,
      int _w,
      int _h,
      String _filename,
      int _rate,
      int _codecType,
      int _codecQuality,
      int _keyFrameRate) {
    parent = p;

    width = _w;
    height = _h;
    rate = _rate;

    try {
      QTSession.open();
    } catch (QTException e1) {
      e1.printStackTrace();
    }

    try {
      ImageDescription imgD = null;
      if (quicktime.util.EndianOrder.isNativeLittleEndian()) {
        imgD = new ImageDescription(QDConstants.k32BGRAPixelFormat);
      } else {
        imgD = new ImageDescription(QDGraphics.kDefaultPixelFormat);
      }
      imgD.setWidth(width);
      imgD.setHeight(height);
      gw = new QDGraphics(imgD, 0);

    } catch (QTException e) {
      e.printStackTrace();
    }
    codecType = _codecType;
    codecQuality = _codecQuality;
    keyFrameRate = _keyFrameRate;
    initMovie(_filename);

    parent.registerDispose(this);
  }