Creating a Rimworld timelapse

You may have seen some beautiful timelapses of Rimworld colonies, including one of these. I recently did a timelapse of my 20-year-old medieval colony, and want to share how I created the video.

1 Creating screenshots

This is the easy part. Just install the Progress Renderer mod in Rimworld and play your game. By default, a screenshot will be taken every day at 08:00. I recommend going to the settings and disabling designations, thing icons, game conditions, and weather in the settings. Especially the latter two can cause some jarring effects when you create a video, causing big visual jumps in between consecutive frames. This distracts from what you actually want to show: the changes in your colony!

2 Combining screenshots

After you've played the game for a while and had the screenshots created for you, you can combine them into a video. I used FFmpeg for this, which is a well-known command-line tool for processing video and audio. It's an extremely powerful tool if you know how to use it, but it's certainly more difficult than other, visual tools. I think it's a much better alternative than importing all your screenshots into Adobe Premiere though, primarily because FFmpeg is made to do one thing, and it does it well. I've seen some people who wrote that they used RimworldRender. I don't have any experience with RimworldRender, but I suppose the advantage of FFmpeg is that you can easily combine it in a whole pipeline of tools and libraries to add music, scaling, zooming, panning, and much more.

2.1 Installing FFmpeg

  • Windows: You can download FFmpeg for Windows from gyan.dev, or you can check the FFmpeg download page for more download options. Simply extract the downloaded archive anywhere you want; let's say you extracted it to C:\Users\FWDekker\Downloads\ffmpeg\ so you have the executable C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe.
  • Linux/macOS: Follow the download instructions on the FFmpeg download page. If you're running a Debian-based distro (including Ubuntu) you can just run sudo apt install ffmpeg. In the instruction below you should replace C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe with a simple ffmpeg.

2.2 Renaming the files

Before you can use FFmpeg to create a video from your screenshots, you have to (temporarily) rename the images. FFmpeg expects the images to have names like 1.png, 2.png, etc. The best way to rename your files depends on your operating system.

2.2.1 Windows

The easiest option on Windows is probably to use Ant Renamer. Let's say that your screenshots from Progress Renderer are stored in C:\Users\FWDekker\Rimworld\.

  1. Download and run Ant Renamer.

  2. Click the Add folders... button, and select the screenshot folder.

  3. Press Actions in the top left.

  4. Go to Enumeration.

  5. Change the settings to the following values:

    • Mask to %num%%ext%.
    • Start at to 1.
    • Number of digits to 3.
    • Increment by to 1.

    These settings are fine even if you have more than 1000 screenshots.

  6. Press Go at the top. The files have been renamed.

Once you've completed this whole guide, you can press the arrow to the right of Go to undo the renaming if you want. If you close Ant Renamer, you will not be able to undo the renaming.

2.2.2 Linux/macOS

  1. Open up a terminal and navigate to the directory containing the images.
  2. Check you're in the right directory using ls -a. Make sure you see no files other than the images you want to rename.
  3. Double check you're in the right directory.
  4. Run the following command to rename all files in the current directory:
    ls -v | cat -n | while read n f; do mv -n "$f" "$n.png"; done
    

2.3 Creating the video

With the files properly renamed, you can run FFmpeg to create the video for you.

  1. Open the Windows command prompt.
  2. Navigate to the directory of screenshots using cd /d "C:\Users\FWDekker\Rimworld".
  3. Run the following command:
    "C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe" -f image2 -r 24 -i %3d.png -vcodec libx264 -crf 24 -pix_fmt yuv420p -vf "crop=5120:3680:2384:3296, scale=1280:920, tpad=stop_mode=clone:stop_duration=3" out.mp4
    
    • -f image2 indicates you're going to work with images.
    • -r 24 sets the frame rate to 24 screenshots per second.
    • -i %3d.png tells what the files are named: three digits following by .png.
    • -vcodec libx264 means that you are using the x264 codec. You can also use libx265 which takes longer and creates smaller files, but Reddit only accepts x264.
    • -crf 24 is the quality of the video. A lower value means higher quality. Typical values are between 18 and 28.
    • -pix_fmt yuv420p is the way pixels are encoded.
    • -vf [...] applies filters to the images, like cropping and scaling.
      • crop=5120:3680:2384:3296 extracts a rectangle from the images, basically zooming in on your images. The format is width:height:x:y, creating a rectangle of size width by height, with the top-left corner at x, y measured from the top-left corner. For some reason, you have to make sure all values are multiples of 8, or else you will get a bunch of warnings.
      • scale=1280:920 resizes the video to the given dimensions.
      • tpad=stop_mode=clone:stop_duration=3 freezes the last frame for 3 seconds, to allow people to enjoy the end of the video.
    • out.mp4 is the file to store the output in, relative to the "C:\Users\FWDekker\Rimworld" directory.

FFmpeg will show you a nice process indicator with some additional stats, and should be done within a few minutes.

2.4 Lowering the quality

If you find that the video is too large, you can repeat the previous step with a higher value for -crf or with a different output size. However, this means that FFmpeg will have to process all your screenshots again, which takes a while. Instead, you can just ask FFmpeg to process your existing video to lower the quality as follows, which takes only a few seconds.

  • To change the quality:
    "C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe" -i out.mp4 -crf 28 out2.mp4
    
  • To change the scale:
    "C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe" -i out.mp4 -vf "scale=640:460" out2.mp4
    

2.5 Adding sound

To spice up your video, you can add music. Store the music file, say in audio.mp3, in the same folder as out.mp4, and then you can use FFmpeg for this step as well:

"C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe" -i out.mp4 -i audio.mp3 -af "afade=t=out:st=50:d=3" -c:v copy -shortest out-with-audio.mp4
  • -i out.mp4 and -i audio.mp3 show which files you want to process.
  • -af [...] applies filters to the audio.
    • t=out:st=50:d=3 means that you're applying the fade out filter, with start time at 50 seconds (st=50), and a duration of 3 seconds (d=3). I chose these values because my video out.mp4 is 53 seconds long, of which the last 3 seconds are a frozen frame. If you don't want a fade out, then replace the -af [...] with -a:v copy.
  • -c:v copy means that you just want to copy the video without any adjustments.
  • -shortest takes the shortest of all your input files, and makes the output as long as that file. So if audio.mp3 is longer than out.mp4, then audio.mp3 is cut off. If you used the fade out, you won't hear the cutoff.
  • out-with-audio.mp4 is the file to store the output in.

3 Advanced techniques

FFmpeg is a very powerful tool, and if you want to, you can use any of its features to enhance your video. You can add panning, zooming, and rotating effects with complex filters. I don't have the experience to tell you how that works exactly, but if you search for ffmpeg panning I'm sure you'll find something useful.


← home