← Back to team overview

yade-users team mailing list archive

[Question #168015]: how to make a video from mill.py

 

New question #168015 on Yade:
https://answers.launchpad.net/yade/+question/168015

Hello again,

Right now I explored the utils.makeVideo() and the utils.encodeVideoFromFrames() function, but the last one is not working correctly.  First I explain what I changed in mill.py (examples folder) to get snapshot engine working. Then I explain how to get a video from mill.py.

First I deleted the #s at the end of mill.py (lines 73 to the end), added "from python import qt" above O.engines[] and changed line 74 to get snapshotengine running:
 ...
	qt.SnapshotEngine(iterPeriod=30,fileBase='/tmp/mill-',label='snapshooter'),
 ...

Note that one also has to comment the O.wait() out (line 82 after "O.run(20000)").

Now one can get the snapshots in the /tmp folder. 
I dont know why, but "utils.encodeVideoFromFrames(snapshooter['savedSnapshots'],out='/tmp/mill.ogg',fps=30)" (line 83) does not work...

Running script mill.py
789   WARN  yade.SpherePack /home/me/yade/pkg/dem/SpherePack.cpp:192 makeCloud: Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 254 spheres was added, although you requested 707.
804   WARN  yade.SpherePack /home/me/yade/pkg/dem/SpherePack.cpp:192 makeCloud: Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 254 spheres was added, although you requested 707.
Numer of grains 508
Traceback (most recent call last):
  File "/home/me/YADE/bin/yade-bzr2877", line 183, in runScript
    execfile(script,globals())
  File "mill.py", line 83, in <module>
    utils.encodeVideoFromFrames(snapshooter['savedSnapshots'],out='/tmp/mill.ogg',fps=30)
TypeError: 'SnapshotEngine' object is unsubscriptable

... So delete this line and replace it with this two lines:

raw_input('press ENTER')
utils.makeVideo(snapshooter.snapshots,out="mill-test.avi",fps=24)

Now it is working and one can get a video from mill.py in the examples folder.

Regards,

Christian


-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.