jybuestc / gource

Automatically exported from code.google.com/p/gource
0 stars 0 forks source link

Rendering single frames instead of a video #219

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Is there an easier way to render single frames of a git repo than converting to 
avi using ffmpeg and then extracting them? We're trying to render large (as 
large as opengl appears to allow) images to use as posters.

Currently I'm running something along the lines of:

gource -a 0.00001 -s 0.00001 --max-file-lag 0.00001 -r 25 --viewport 9700x6858 
-o - | ffmpeg -y -r 10 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset 
ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4

Where the -a, -s, -r are trying to make the video as short as possible.
And then: 

ffmpeg -i ../gource.mp4 -f image2 -vf fps=fps=1/5 img%03d.jpg

To convert that to frames. 

However, currently, for a ~15 second video it takes up to two hours to draw. Is 
there an easier way to extract the frames? 

Original issue reported on code.google.com by Peg...@gmail.com on 8 Jul 2014 at 9:08

GoogleCodeExporter commented 8 years ago
Interesting idea!

F12 saves a sequentially numbered png (old versions it was a tga) to the 
current working directory.

I guess you could modify the source code to save a screenshot periodically. See 
the end of gource.cpp for where it saves a screenshot. Perhaps do something 
like:

if((t-last_screenshot) > screenshot_interval) {
    last_screenshot = t;
    take_screenshot = true;
}

t is a float containing the time in seconds since Gource started.

Original comment by acaudw...@gmail.com on 8 Jul 2014 at 9:33

GoogleCodeExporter commented 8 years ago
Thanks for getting back to me, appreciate it's not really a 'defect'

The reason I stopped using screenshots was because --viewport 9700x6858 appears 
to be ignored once the viewport is larger than my monitor unless -o is 
specified, so those screenshot png's come out at 1920x1080

Can you think of a way for it to be unignored?

 - Perhaps I could look into modifying the code to only draw one frame per second, rather than being limited to the defaults. Though I gather some of the timing is dependent on the framerate?

Original comment by Peg...@gmail.com on 8 Jul 2014 at 9:38

GoogleCodeExporter commented 8 years ago
Maybe try:

gource -9700x6858!

the '!' stops the window from being resizeable, that may be why its getting 
changed back to your screen resolution (not quite sure). Though when I tried 
this, only the visible part of the window gets rendered.

You could also try running gource under x virtual frame buffer, and just 
specify a huge size for the screen:

http://code.google.com/p/gource/issues/detail?id=29#c11

Original comment by acaudw...@gmail.com on 9 Jul 2014 at 1:52

GoogleCodeExporter commented 8 years ago
Using ! works perfectly, through trial and error, it looks like tha largest 
window that OpenGL seems to support is 9700x6858

Which leaves my final command at: 
gource --file-filter "(vendor|migrations|old|propel/om|propel/map)" -p 0.001 
--bloom-intensity 0.5 -a 0.00001 -s 0.00001 --max-file-lag 0.00001 -r 25 
--viewport 9700x6858! --bloom-multiplier 0.5 --hide users,usernames,date 
--max-files 0 -i 0 -c 4

The only other query I have is if you know of a way to skip time without 
resetting the screen? Ideally I'd like to be able to jump to the last second 
instead of having to wait for everything to play, but if you move the tree gets 
reset.

Original comment by Peg...@gmail.com on 9 Jul 2014 at 12:35

GoogleCodeExporter commented 8 years ago
You can't just skip ahead as you still have to run the simulation.

In theory you may be able to modify it so the Gource::draw method is only 
called when you actually want to take a screenshot (it is called from 
Gource::update). In practice it may have some side effects, but it would be 
worth trying.

Original comment by acaudw...@gmail.com on 9 Jul 2014 at 10:32