Making Movies from Simulations
Here is a method for creating an MPEG or AVI movie, or animated GIF, from your simulation animation.
- Include movie_camera.sim in your simulation. (Right-click to download on some browsers.) Make one instance of this model on your top level diagram. The box can be made vanishingly small.
- Run the simulation. The movie_camera.sim model snaps a picture of the SimView canvas at the period set within the DELAY in the while-loop. You may wish to modify the snap period, and/or place a DELAY call ahead of the while-loop to reach steady-state before capturing frames.
The result of this step is a set of files called frame_00000.ppm to frame_00xxx.ppm, numbered sequentially. 3. Run ppmtompeg or any other movie making utility. Here we explain how to use ppmtompeg. - A. Create a param.dat file, like:
```
PATTERN IBBPBBPBBPBBPBBBBPBBPBBPBBPBBB
OUTPUT movie.mpeg
INPUT_DIR .
INPUT
frame_*.ppm [00000-00323]
END_INPUT
BASE_FILE_FORMAT PPM
INPUT_CONVERT *
GOP_SIZE 15
SLICES_PER_FRAME 10
PIXEL HALF
RANGE 5
PSEARCH_ALG TWOLEVEL
BSEARCH_ALG CROSS2
IQSCALE 2
PQSCALE 2
BQSCALE 2
REFERENCE_FRAME ORIGINAL
FRAME_RATE 24
END_INPUT
```
Note that you must set the range of frames to use on line 5 of param.dat.
- B. Run ppmtompeg:
ppmtompeg param.dat 4. Play your movie:
mplayer movie.mpeg
Advanced Method
The above method captures just the canvas of the SimView window. If you wish to capture the outer control panel as well, you may try the following method.
- Include movie_camera2.sim in your simulation.
(Right-click to download on some browsers.) Make one instance of this model
on your top level diagram, and place the following image on it. (Again, right-click to save the image below. (save-image-as))
. - Place a dummy box with the following image on it. (Again, right-click to save the image below.)
. - Follow remaining instructions above.