It is often very useful to build a video from an execution of LEPTON. The principle is to produce still images (PNG files) during the LEPTON execution, in a given directory. The set of images is then processed to produce a video file.
We illustrate here the different configuration parameters that allow the customization of the video.
Let us start with the simple LEPTON execution showed in the "step by step"
tutorial (section Getting started), with the pre-defined configuration in
conf/lepton.conf
. This execution represents 20 nodes that follow a Levy Walk
mobility pattern, in a 200 m. x 200 m. area.
We first just add a configuration option video_img_dir
in order to save the
successive images of the execution (one image per execution step). The image
directory is automically created if it didn't exist.
lepton.sh start video_img_dir=./vimg \
stylesheet="node {fill-mode: plain; text-alignment: above; size: 8px; fill-color: orange; text-color: orange;} \
edge {shape: line; fill-mode: dyn-plain; size: 1px; fill-color: cyan;}"
The LEPTON window should appear, displaying the moving nodes and transient links between them. After a while, you can stop the simulation:
lepton.sh stop
The video directory should be now populated with a number of PNG files.
To build a video from these files, you can use the script mkmovie.sh
provided with LEPTON, and based on ffmpeg:
mkmovie.sh -i ./vimg
This should produced a video file with the default name movie.mp4
in the
video image directory. This video is somehow the reflection of what you've
seen onscreen, in the LEPTON window.
Note that you are not forced to display the LEPTON window while producing the
images. For this, use the option show
, most probably in conjunction with the
duration
option. For example, the following command will produce images
for a one-minute movie, without displaying any window.
lepton.sh start video_img_dir=./vimg show=false duration=60
When building a video with mkmovie.sh
, by default, the resolution of the
video is the same as the resolution of the images. But you may want to choose a
different resolution for the video (for example to produce a smaller
one). Likewise, you may want to choose the framerate (the default is
10 fps). Finally the name of the video file can also be chosen. The following
example give specific values for these options:
mkmovie -i ./vimg -r 320x400 -f 8 -o mymovie.avi