export animation

93 views
Skip to first unread message

Trumpetto

unread,
Oct 18, 2010, 8:52:21 AM10/18/10
to NodeBox for OpenGL
Hi all,

Is there a way to save/export an animation in NodeBox for OpenGL?

Thanks, Trumpetto

Tom De Smedt

unread,
Oct 19, 2010, 3:55:29 AM10/19/10
to NodeBox for OpenGL
You can create a movie with a tool that converts a sequence of
separate images, for example ffmpeg (http://www.ffmpeg.org/). On
Windows you can use VirtualDub and on Mac you can use ffmpegX (both
have a GUI). I use ffmpeg from the command line. Download it and
follow the install instructions (i.e. ./configure; make; sudo make
install).

In NodeBox for OpenGL, you can export each frame as follows:

def draw(canvas):
# Draw stuff here...
# Finally, export each frame as a sequentially numbered PNG:
canvas.save("%05d.png" % canvas.frame)

You can then convert the image sequence from the command line:

ffmpeg -i %05d.png test.mp4

Cleanup the separate image files and you're done.

Tom

Trumpetto

unread,
Oct 19, 2010, 4:53:50 AM10/19/10
to NodeBox for OpenGL
Hi Tom,

OK, that's what I did before with the 'regular' Nodebox but I hoped
for an easier route :-)

Thanks, Trumpetto

Tom De Smedt

unread,
Oct 19, 2010, 9:25:12 AM10/19/10
to NodeBox for OpenGL
Here is an interesting example with a Movie class wrapping ffmpeg:
http://dev.nodebox.net/browser/nodebox-gl/trunk/examples/12-experimental/03-movie.py

It also has a link to an ffmpeg binary compiled for Mac OS X 10.3-5
For the moment, I have no plans to make this an official addition,
however.

Tom

Trumpetto

unread,
Oct 19, 2010, 11:29:11 AM10/19/10
to NodeBox for OpenGL
Malevich on his final bottle of wodka ...


On Oct 19, 3:25 pm, Tom De Smedt <tomdesm...@gmail.com> wrote:
> Here is an interesting example with a Movie class wrapping ffmpeg:http://dev.nodebox.net/browser/nodebox-gl/trunk/examples/12-experimen...

Trumpetto

unread,
Nov 2, 2010, 4:42:00 PM11/2/10
to NodeBox for OpenGL
Works very nice!

Where should I add arguments to reduce the compression or choose
another format in that example ?

http://dev.nodebox.net/browser/nodebox-gl/trunk/examples/12-experimental/03-movie.py

Trumpetto

Tom De Smedt

unread,
Nov 3, 2010, 6:17:03 PM11/3/10
to NodeBox for OpenGL
I've updated the example with parameters for compression and
framerate:
http://dev.nodebox.net/browser/nodebox-gl/trunk/examples/12-experimental/03-movie.py

Different formats can be obtained by giving a different filename
extension (I think).

Trumpetto

unread,
Nov 4, 2010, 7:22:25 PM11/4/10
to NodeBox for OpenGL
Thanks very much.

Works perfect.
I use a compression of 0 now as I need to do some additional editing
on the output.

I have not yet experimented with other formats but I will soon.

My machine seems to hang on animations longer than 1 minute but that's
no problem for my project.

Reply all
Reply to author
Forward
0 new messages