2021-07-18 11:08:43 +02:00
|
|
|
---
|
|
|
|
title: Creating a Rimworld timelapse
|
2021-11-14 11:23:58 +01:00
|
|
|
tags: post
|
2021-07-18 11:08:43 +02:00
|
|
|
layout: post
|
|
|
|
date: 2021-07-18
|
|
|
|
permalink: creating-a-rimworld-timelapse/
|
|
|
|
excerpt: How to create a timelapse of your Rimworld colony using FFmpeg.
|
|
|
|
---
|
|
|
|
|
|
|
|
You may have seen some beautiful timelapses of [⎋ Rimworld](https://rimworldgame.com/) colonies, including
|
2021-07-18 14:56:52 +02:00
|
|
|
[⎋one](https://www.reddit.com/r/RimWorld/comments/igy7am/)
|
|
|
|
[⎋of](https://www.reddit.com/r/RimWorld/comments/jxoo49/)
|
|
|
|
[⎋these](https://www.reddit.com/r/RimWorld/comments/ewjruc/).
|
|
|
|
I recently did a
|
|
|
|
[timelapse of my 20-year-old medieval colony](https://www.reddit.com/r/RimWorld/comments/omnsg1/), and want to share how
|
|
|
|
I created the video.
|
2021-07-18 11:08:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
## 1 Creating screenshots
|
|
|
|
This is the easy part.
|
|
|
|
Just install the [⎋ Progress Renderer](https://steamcommunity.com/sharedfiles/filedetails/?id=2010777010) 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](https://ffmpeg.org/) for this, which is a
|
|
|
|
[⎋ well-known](https://en.wikipedia.org/wiki/FFmpeg) 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](https://github.com/Epicguru/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.
|
|
|
|
|
2022-05-26 21:52:30 +02:00
|
|
|
### 2.1 Installing FFmpeg
|
|
|
|
* **Windows:**
|
|
|
|
You can download
|
|
|
|
[⎋ FFmpeg for Windows from gyan.dev](https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z),
|
|
|
|
or you can check the [⎋ FFmpeg download page](https://ffmpeg.org/download.html) 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](https://ffmpeg.org/download.html).
|
|
|
|
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`.
|
2021-07-18 11:08:43 +02:00
|
|
|
|
2022-05-26 21:52:30 +02:00
|
|
|
### 2.2 Renaming the files
|
2021-07-18 11:08:43 +02:00
|
|
|
Before you can use FFmpeg to create a video from your screenshots, you have to (temporarily) rename the images.
|
2022-05-26 21:52:30 +02:00
|
|
|
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](http://www.antp.be/software/renamer).
|
2021-07-18 11:08:43 +02:00
|
|
|
Let's say that your screenshots from Progress Renderer are stored in `C:\Users\FWDekker\Rimworld\`.
|
|
|
|
1. [⎋ Download](http://www.antp.be/software/renamer/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.
|
2022-05-26 21:52:30 +02:00
|
|
|
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.
|
2021-07-18 11:08:43 +02:00
|
|
|
|
2022-05-26 21:52:30 +02:00
|
|
|
#### 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 `lv -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:
|
|
|
|
```shell
|
|
|
|
ls -v | cat -n | while read n f; do mv -n "$f" "$n.png"; done
|
|
|
|
```
|
2021-07-18 11:08:43 +02:00
|
|
|
|
2022-05-26 21:52:30 +02:00
|
|
|
### 2.3 Creating the video
|
2021-07-18 11:08:43 +02:00
|
|
|
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:
|
|
|
|
```shell
|
2021-07-18 14:56:52 +02:00
|
|
|
"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
|
2021-07-18 11:08:43 +02:00
|
|
|
```
|
|
|
|
* `-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`.
|
2021-07-18 14:56:52 +02:00
|
|
|
* `-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.
|
2021-07-18 11:16:26 +02:00
|
|
|
* `-crf 24` is the quality of the video. A lower value means higher quality. Typical values are between 18 and 28.
|
2021-07-18 11:08:43 +02:00
|
|
|
* `-pix_fmt yuv420p` is the way pixels are encoded.
|
|
|
|
* `-vf [...]` applies filters to the images, like cropping and scaling.
|
2022-05-26 21:52:30 +02:00
|
|
|
* `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.
|
2021-07-18 11:08:43 +02:00
|
|
|
|
|
|
|
FFmpeg will show you a nice process indicator with some additional stats, and should be done within a few minutes.
|
|
|
|
|
2022-05-26 21:52:30 +02:00
|
|
|
### 2.4 Lowering the quality
|
2021-07-18 11:16:26 +02:00
|
|
|
If you find that the video is too large, you can repeat the previous step with a higher value for `-crf` or with a
|
2021-07-18 11:08:43 +02:00
|
|
|
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:
|
|
|
|
```shell
|
|
|
|
"C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe" -i out.mp4 -crf 28 out2.mp4
|
|
|
|
```
|
2021-07-18 11:16:26 +02:00
|
|
|
* To change the scale:
|
2021-07-18 11:08:43 +02:00
|
|
|
```shell
|
|
|
|
"C:\Users\FWDekker\Downloads\ffmpeg\ffmpeg.exe" -i out.mp4 -vf "scale=640:460" out2.mp4
|
|
|
|
```
|
|
|
|
|
2022-05-26 21:52:30 +02:00
|
|
|
### 2.5 Adding sound
|
2021-07-18 11:08:43 +02:00
|
|
|
To spice up your video, you can add music.
|
2022-05-26 21:52:30 +02:00
|
|
|
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
|
2021-07-18 11:08:43 +02:00
|
|
|
well:
|
|
|
|
```shell
|
|
|
|
"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.
|
2022-05-26 21:52:30 +02:00
|
|
|
* `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`.
|
2021-07-18 11:08:43 +02:00
|
|
|
* `-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.
|