Skip to content

Instantly share code, notes, and snippets.

@jxu
Forked from Bilka2/control.lua
Last active January 8, 2023 23:53
Show Gist options
  • Save jxu/9a83751b0bf9d717a6893e0b86cc48fe to your computer and use it in GitHub Desktop.
Save jxu/9a83751b0bf9d717a6893e0b86cc48fe to your computer and use it in GitHub Desktop.
Create a timelapse from a factorio replay save file
-- Just add this to the end of the control.lua file in the save file and then replay the file
script.on_nth_tick(1800, function(event)
game.take_screenshot{
surface = game.surfaces[1],
position = {0,0},
resolution = {3840,2160},
zoom = 0.2,
path = "timelapse/" .. string.format("%06d", event.tick/event.nth_tick) .. ".jpg",
quality = 95,
show_entity_info = true,
allow_in_replay = true,
daytime = 0
}
end)
@jxu
Copy link
Author

jxu commented Jan 8, 2023

ffmpeg convert to video

 ffmpeg -framerate 30 -i %06d.jpg -vcodec libx264 -r 30 timelapse.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment