Hi, again
> s there any way to speed up the SaveAs()?
Probably the best way to speed up is saving canvas in
some "raw" format which can be better/faster fitted/processed by ffmpeg.
By saving canvas in png, gif etc and then processing it by ffmpeg
we have two overheads:
1. while compressing canvas to an image
2. while decompressing the image internally by ffmpeg
AFAIK, the best input format for ffmpeg is "raw video format" , i.e. yuv (4:2:0, 4:2:2). See http://en.wikipedia.org/wiki/YUV So, saving canvas in yuv422 would be perfect for ffmpeg (good idea:).
Regards. Valeriy
-----Исходное сообщение-----
От: owner-roottalk_at_root.cern.ch от имени Tom Roberts
Отправлено: Чт, 3/12/2009 5:06
Кому: 'ROOT Talk'
Тема: [ROOT] Generating a movie
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
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 Fri Mar 13 2009 - 12:52:24 CET
This archive was generated by hypermail 2.2.0 : Mon Mar 16 2009 - 11:50:01 CET