Re: Generating a movie

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 12 Mar 2009 11:44:10 -0500


Hi Tom,

You can speed things up by disable the graphical display:

     root -b -q movie.C

-b: batch mode
-q: exit after executing movie.C (hence you do not need the call to Terminate).

Cheers,
Philippe.

Tom Roberts wrote:
> I want to generate a movie of the data contained in a TNtuple.
>
> The TNtuple rows each contain one sample of a track:
> t,x,y,z,Px,Py,Pz,trackID,particleID.
> There are ~100 tracks in the TNtuple, ~100,000 total rows.
> The beam center is along the z axis.
>
> My current plan is to generate successive frames using an x-y plot of
> the TNtuple with a cut on t, do canvas->SaveAs("movie_%d.png") [%d =
> frame number], then increment the cut on t and the frame number,
> repeating until the TNtuple has no remaining entries. I'll increment t
> corresponding to the movie's frame rate, interpolating the TNtuple
> data (ensuring that each existing track has exactly 1 entry).
>
> [I have more sophisticated plans; this is the simplest to
> describe and covers the essential issues.]
>
> That generates hundreds to thousands of .png files. I then use ffmpeg
> to convert them to a movie (this is a remarkable, open-source tool).
> http://www.ffmpeg.org/
>
> The attached macro generates 500 frames of a 21-second movie using
> test data (25 trajectories each moving in a randomized circle):
> root movie.C
> --- took 73 sec
> ffmpeg -r 24 -i m_%d.png m.mov
> --- took 6 sec
> Commenting out the SaveAs(), the macro executes in 4 sec, essentially
> all of which is overhead, so there's not much point in optimizing or
> compiling it.
>
> This is not bad, creating the movie at a rate of 1/4 real time. But I
> am new to making movies and wonder if I'm missing something obvious.
> So I ask:
>
> Is there a better way to do this?
> Are there better tools available?
> Is there any way to speed up the SaveAs()?
> The canvas was clearly visible and updated at each frame; can that be
> avoided to speed it up?
> Which image format is best? (ffmpeg supports most)
> Which movie format is best? (ffmpeg supports most)
>
>
> BTW I salute the entire Root team for making such a flexible program!
> It's amazing that I could start from just a vague notion and create
> such a test movie in about 1/2 day (half of which was finding ffmpeg).
>
>
> Tom Roberts
Received on Thu Mar 12 2009 - 17:44:17 CET

This archive was generated by hypermail 2.2.0 : Thu Mar 12 2009 - 23:50:01 CET