I prepared a tutorial aimed towards bringing together all the information I have gathered on capturing images to disk using UE4, providing a “from scratch” approach using SceneCaptureComponent2D. It will enable you to capture images “in-game” tested with up to 30fps depending on your system without blockign the rendering thread.
I use UE4 to generate datasets for deep learning, where I noticed that there is yet a source of information missing on how to approach this. There are of course a lot of post in this forum and also AnswerHub, regarding this topic, but to my knowledge non gives a full solution. It is also to mention that there are plugins available, such as AirSim and UnrealCV, which enable just what I want to teach in this tutorial. These are open source but do not directly enclose how the capturing process is working. If you find yourself in the situation where you want to redo capturing without one of these plugins, may it be for support reasons on the newest engine version (where of course this may also not apply to this post) or wanting to only have the capturing feature without the accessary parts, then this might be what you are searching for.
Currently supported Engine versions are 4.18 - 4.22 (should also work in 4.23 and 4.24, as it implements ENQUEUE_RENDER_COMMAND introduced in 4.22, but is not tested)
As this tutorial includes a lot of code snippets, please find it on my github repository.
There I also provide a very basic test project so you can directly test the code.