Screen Recorder - DEPRECATED

We have released a screen recorder extension on our GitHub page. The extension was originally developed by @sergey.lerg, with some modifications from the Defold team.

One of the key features of this extension is the ability to save just last N seconds of the gameplay. The extension maintains a circular buffer for encoded data and saves it when requested. On Android, macOS, Linux, Windows and HTML5 the circular encoder stores it’s data in memory, on iOS the circular encoder saves to temporary video files and then joins them together to produce desired duration.

Audio capture is not implemented, however the extension provides a function to mux a prepared audio file with the captured video.

28 Likes

this is great! thanks a lot

2 Likes

I read somewhere that too much good things a day is harmful for health :grin:
just joking, impressive extension. thanks a lot for developing this for us @sergey.lerg and the Defgang :fire:

3 Likes

This sounds like it would be really useful for allowing users to share cool moments / the last few moments alive to social media!

Yes, that how Blastlands uses it. I think @andreas.strangequest could tell more about it.

2 Likes

Yes, we use it to produce “highlights” of the teammatch gameplay. For our implementation that required that we saved (or fetched) the whole teammatch data (how people were running, shooting, explosions, yes the whole match essentially), valued and balanced what happened and picked out 3 “most exciting” time ranges and replayed them in the client while recording it with the extension.
So for our usecase we had to replay it/“force” the player to watch the replay before we could let the player send the clip to friends or social media.

3 Likes

I haven’t tried it but it seems like you’d be able to render multiple frames per renderscript update by setting a render target and repeatedly calling clear() and draw(). @britzl Is there a way to force an update tick with a supplied deltatime? If so it would be possible to record replays without forcing the user to rewatch them. Rough pseudocode:

render.set_render_target("replay_render_texture")
render.clear()
render.draw("everything")
add_frame_to_video()
replay_timer = 0
delta_time = 1/60
while (replay_timer < replay_length)
	game.update(delta_time)      -- is this possible?
	render.clear()
	render.draw("everything")
	add_frame_to_video()
end
save_video()

I believe that wouldnt be possible today. Also just taking our game as an example, our game was struggling keeping the 60fps on many devices so in best case for a 30 fps movie it would be recording in half the time it would take to watch it (30 sec clip would render for 15 sec without watching). That would still be a very bad user experiencing looking at some “wait” screen while it was processing so for us it was the best decision anyway.

1 Like

I’ve also been thinking about saving replays from my game, which is an extremely low resolution pixel art game with no post-processing. I should be able to render dozens if not hundreds of replay frames per screen frame while ticking up a visible progress bar. But I’d need a way to trigger the update functions and message passing of the gameplay objects to simulate the replay in the background.

This extention project is no longer opening with latest version of Defold. Can anyone take a look on this.

Does it crash straight away? With what error? Have you opened a ticket in the GitHub repo for the extension?

Tested with Defold version 1.4.7 beta it’s crash straight. While latest verison 1.5.0 can open the project but can’t build. Some Dirrtylarry gui componets missing errors. Will try if I can make it work. Will add ticket on github repo.

I have to use specific older gooey dependency release(7.5.0) to make it run.

Now After tapping “LABEL” button here getting this build error -

ERROR:SCRIPT: example/modules/recorder.lua:160: Table's property render_target is not a lightuserdata.
stack traceback:
  [C]:-1: in function init
  example/modules/recorder.lua:160: in function init
  example/logic/example.gui_script:9: in function func_init_recorder
  example/logic/example_ui.lua:205: in function fn
  gooey/internal/button.lua:31: in function button
  gooey/gooey.lua:71: in function button
  example/logic/example_ui.lua:203: in function on_input
  example/logic/example.gui_script:100: in function <example/logic/example.gui_script:99>

I have added issues in github repo for this.

If someone had used this extension before. How this works. Is it possible to record gameplay collection screen but not gui scene in collection.

The extension was community contributed and provided as-is. It has now diverged from the Defold code base too far and it is not useful anymore. Because of this we have decided to archive the extension, meaning that it is read-only and will not receive updates.

There is a PR solving the outdated Gooey library and the render target error, but there is still work left if someone wants to fork the repo.

If you need to do a quick screen recording then perhaps use the built-in video recorder instead?

5 Likes