Python and animations

I’m finding that on one of my machines (a Mac), I can’t dump my output to a movie from a IPyLammps script with the command:

L.dump("3 all movie 100 anim.mpeg type type adiam 1.0")

The same script, run on a linux machine, has no problem. There is also no problem on the Mac if I run this as a standard script with the command line. Any suggestions on how to troubleshoot/resolve this?


CCing Richard, IPyLAMMPS is not part
of LAMMPS, right? Is there an author you can
ask these Qs to directly?


dump movie requires ffmpeg. That isn’t IPyLammps specific, but is always the case. Is it installed on the mac? If so maybe its PATH is somehow messed up. Otherwise I’d have to see the scripts.

PS: I’m the author of both PyLammps and IPyLammps. IPyLammps just adds a few utilities for IPython notebooks. In this case allowing to embed a generated video.


ffmpeg is installed on the Mac, and if I run a standard (i…e, non-python) lammps script with the dump movie command, it works as expected.

Try running this in IPython and tell me if you get a valid output or a command not found:

import subprocess
subprocess.check_output(“ffmpeg -h”, shell=True)


Yes, I see the same output as if I were to run ffmpeg -h in the terminal.

Just to get the obvious out of the way:

You do know that the dump command alone won’t do anything? You need to run the simulation and then you should have a movie file that got generated during that run. That file can then be embedded in a IPython notebook.

Did you compile the shared library with -DLAMMPS_FFMPEG?

Where does it fail in IPython? In the dump command, the run, or does the output after the run simply not exist?


Ugh, I hate to be that guy, but now it’s working fine on my Mac. I think the issue is that I was trying to save as .mp4 and did not have that codec on my Mac.