Making an MPEG Movie with Data Explorer 

Preparing Frames

In order to MPEG encode your animation, you need to store your frames in separate files. In order to do this, connect the MPEGmac module in your program as seen below:

In order to download this module, click here. When the window showing the file opens, use the "save as" option to put the file in your directory. Once it is there, move the file to your ".DXmacros" directory so that the macro is loaded into DX automatically upon startup. [If you do not do this before you start DX, the macro will not appear in DX. You can then use the "load macro" option in the DX user interface (under the "File" heading) to load the macro.] A new entry named "Mpeg" will appear in the "Categories" menu of DX. If you select this, you will see "MPEGmac" listed in the tools window. Select this and hook it up as shown in the example above.

The MPEGmac macro will automatically write out the images in your animation in the correct file format and with the correct names. There are a couple of points to be careful about.

Connecting MPEGmac to Applications

Suppose, I want to animate the gravitational sphere, and generate movie frames to encode with mpeg_encode .

  • First, we load the MPEGmac.net macro into DX
  • Next, the hookup of the macro to your application should look like this:
  • Creating an MPEG movie

    After stepping the animation frame by frame, the current working directory contains a set of files created by MPEGmac with the names image.000.yuv, image.001.yuv, etc. It also assumes that each yuv file has a corresponding size file image.000.size etc. These are all written by MPEGmac. Next, we count the number of such files and construct a file called dx.param. This is a parameter file for the MPEG encoder (an example is given here ). It indicates such things as the starting and ending frame file names and the tradeoff between compression and image quality. If you want to experiment with different MPEG encoding settings, you can edit dx.param.

    Next, we have to execute the program called mpeg_encode, which will construct the MPEG file and save it with the name image.mpg.

    mpeg_encode dx.param

    The MPEGmac macro makes sure that all of the files are written out in a certain format (YUV) and with very specific file names. The file names are important because the parameter file used by the mpeg_encode command as written requires this specific format. This is not required, but makes the process somewhat easier to implement.

    For a User's Guide on the MPEG Encoder click here .

    Viewing an MPEG Movie

    You can view an MPEG animation with any standard mpeg player.

    To get the source of mpeg_encode which can be compiled on OS X click mpeg_encode source here .