Making videos of VPython animations

772 views
Skip to first unread message

Bruce Sherwood

unread,
Jul 10, 2014, 3:41:11 PM7/10/14
to vpytho...@googlegroups.com
Added to the vpython.org FAQ:

Jay Wang has posted a detailed description of how to make a movie of a VPython animation, along with many interesting examples:

http://www.faculty.umassd.edu/j.wang/vp/movie.htm

Steve Spicklemire

unread,
Jul 15, 2014, 6:49:52 PM7/15/14
to vpytho...@googlegroups.com
Thanks Bruce (and Jay). 

I followed Jay's link to a fixed up bounce.py

This is a great example for windows users. To get Jay's 'bounce.py' program to work on the Mac I had to make two changes. Apparently PIL's ImageGrab is Windows only. I found this:

import pyscreenshot as ImageGrab

The pyscreenshot module claims to be cross platform. (you can "pip install pyscreenshot")

subprocess.call takes a list of arguments as its first argument. On the mac at least if you pass a single string with embedded spaces it tries to find a single executable with that name (including the spaces!) which naturally fails. If I 'split' the string it appears to work:

call("ffmpeg -r 20 -i img-%3d.png -vf scale=412:412 -y movie.avi".split())

Anyway, I hope that helps folks who try this out on a mac (and possibly linux as well!)

-steve
Reply all
Reply to author
Forward
0 new messages