Screenshot every frame?

Ask gaming related questions (AHK v1.1 and older)
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Screenshot every frame?

30 Jan 2016, 03:18

Hi to all.

I have searched for this but haven't found the answer to it. Is it possible to program ahk to take screenshot in game every frame? My inspiration comes from program called Dxtory who has that option. Currently i am using MSI afterburrner for taking screenshots and have successfully programmed for auto repeating screenshot and taking 10 screenshots than stoping with delay of 250 miliseconds.

Here are the scripts i have created:

Auto repeat

Code: Select all

SetKeyDelay, 1000, 0

i := 0
toggle := 0
$Pause::
    toggle := !toggle
    if (toggle) {
        SetTimer, SCR, On
    } else {
        SetTImer, SCR, Off
    }
return

SCR:
    SendEvent, {Insert}
return


10x screenshots

Code: Select all

SetKeyDelay, 250, 0


$PrintScreen::

SendEvent, {insert 10}
return
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Re: Screenshot every frame?

30 Jan 2016, 10:07

evilC wrote:I am not seeing why your first example is not what you want.
What is wrong with it?
EvilC thanks for the answer, sorry i am a bit lacking in this regard, so 1 frame is 1000 miliseconds or 1 second, if i understood you correctly?
User avatar
tidbit
Posts: 1273
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Screenshot every frame?

30 Jan 2016, 19:09

1 second = 1000ms
if your game is running 60fps (frames per SECOND): 1000/60 = 16.66ms.
you'll need to take a screenshot every 16-17ms.
but ahk has an accuracy of about 15ms for timers/sleep.
so you'll basically get a screenshot every 15-30ms (60-30fps).

ps: you never define a time for SetTimer, SCR. using "on" sets it to the default of 250 (4fps) if you never gave it a value
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Re: Screenshot every frame?

31 Jan 2016, 09:36

tidbit wrote:1 second = 1000ms
if your game is running 60fps (frames per SECOND): 1000/60 = 16.66ms.
you'll need to take a screenshot every 16-17ms.
but ahk has an accuracy of about 15ms for timers/sleep.
so you'll basically get a screenshot every 15-30ms (60-30fps).

ps: you never define a time for SetTimer, SCR. using "on" sets it to the default of 250 (4fps) if you never gave it a value
tidbit thanks for the clarification, what if my game jumps from 60 fps to 20 fps? The problem is that the game doesn't have set fps but constantly changing depending on the scene.
How in the situation when fps is let's say 20 fps than jumps to 40 fps? If i understood you correctly that value of 250(4 fps) is set, it doesn't change depending on the fps?
User avatar
tidbit
Posts: 1273
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Screenshot every frame?

31 Jan 2016, 10:24

ahk has absolutely no relation to your game (or any game). it has no idea what FPS your game is running at (or any game). That's for you to somehow figure out.
Once you figure out how to detect that, you need to update the "Period" in the "SetTimer, Label, >>>Period<<<" command to the desired fps.

Any reason you don't just use a screen recorder like OBS (open broadcaster software)? AHK isn't really meant for this kind of task.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
S0L
Posts: 21
Joined: 22 Jan 2014, 09:34

Re: Screenshot every frame?

31 Jan 2016, 16:17

tidbit wrote:ahk has absolutely no relation to your game (or any game). it has no idea what FPS your game is running at (or any game). That's for you to somehow figure out.
Once you figure out how to detect that, you need to update the "Period" in the "SetTimer, Label, >>>Period<<<" command to the desired fps.

Any reason you don't just use a screen recorder like OBS (open broadcaster software)? AHK isn't really meant for this kind of task.
Ok tidbit thank you, and OBS can he capture screenshots every frame?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 39 guests