Jump to content

Recording / dumping -replay-visual to disk (video)


Recommended Posts

Really off-top but I am curious to know what most people here use to screen capture their battles and trying to understand if it's possible to dump video on OpenGL directly, ie after reading http://stackoverflow.com/questions/7634966/save-opengl-rendering-to-video (I understand the resolution factor, FPS, etc) but can a simulation that was setup w/ 2 AIs be sent directly to video in some fashion?

Link to comment
Share on other sites

You can just write a screenshot every frame and force a given framerate (which is only useful for replays as you  can't really control the camera anymore). You can save uncompressed bitmaps too, but that will consume way too much diskspace. Noone will notice the difference if you use a proper resolution and image format (still 1.5-2MB per frame).If you don't use cinematic paths then you won't be able to do too many things with the camera besides moving it slowly in one direction (as seen in older trailers). The alpha 20 trailer was hacked this way. I can upload those hacks if you like:

 

Link to comment
Share on other sites

I think I actually did patch for the cinematic demo map a while back to take a look at it (not sure if these are the same hacks you are referring to) but in watching this again I realize what the problem is in that there isn't one single solid camera source that would capture an entire session and it wouldn't really make sense on following a center or unit really.  What I was hoping for was say you take the random/continent map and fix the camera in between the 2 civic centers and hold it there for watching a replay between many simulations.  I was just hoping that maybe I could patch pyrogensis to accept an output directive (--replay-video=) to write a simulation w/ no visual somehow, is your hack on a branch somewhere?

Edit: I have found much of what agentx writes about in older posts similar to what I want to attempt to do (it seems that some excellent threads like this one died out), but mainly of the video (gcl, etc) tools he found where what I was looking for.  I have been running sims all day and making notes of end games / issues but also making a smaller "0ad-lite" copy w/ just 1 civ (athens) to pass along to a friend to explore.  In the end I would like to record all these sims.

 

Edited by jonbaer
Link to comment
Share on other sites

Here the patch for screenshot rendering (alpha 20). You can set the framerate and the start time in the options: http://pastebin.com/MMmZeEz9

If you compile with this patch, you can run a visual replay in the background and will get one screenshot per frame (which can be merged to a video with ffmpeg and the like).

To create a camera path I used this patch http://pastebin.com/ihHuDSuz. When pressing escape it will output the current camera coordinates as XML to the command line output. Thus one can copy & paste the waypoints for the cinematic path to the map files.

You might also want to use the follow player feature of the observermode to see what happened in a match.

Link to comment
Share on other sites

OK was able to git checkout master to A20 + apply both patches (had to realize it was trying to write to '/media' @ first) but I got 

<Node deltatime="1"><Position x="583.288391" y="154.026138" z="653.991821"/><Target x="596.535034" y="43.869553" z="798.395630"/></Node>

Applied, saved, and ffmpeg the video together, but is there anyway to push the screenshot(s) to another thread so that it is faster to write w/o affecting the game? (I don't know much about the rendering code) ... for the time being I am doing the screen cap w/ Quicktime w/o audio + then post apply a soundtrack (for now).

Edit: So I read a pretty good explanation of what the case is ...

"The main problem is that glReadPixels is a synchronous call, unlike almost all other OpenGL. The driver/GPU has to lock the framebuffer from modification while the data is being copied out to some temporary buffer which prevents any drawing obviously. That by itself would not be that bad. The really nasty bit is that the OpenGL specification promises that you will have the data you asked for as soon as the call returns (basically an implicit glFinish()). This means that you will have to wait in that call for a full CPU-GPU-CPU roundtrip, which can and does take a while. In contrast, other OpenGL operations don't make such promises and are completely asynchronous. Often you just tell OpenGL to "get stuff done some time in the future"."

And then I found a direct to ffmpeg solution @ http://blog.mmacklin.com/2013/06/11/real-time-video-capture-with-ffmpeg/ which seems ideal if I wrote my own function into ps/Util (guessing) ...

Edited by jonbaer
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...