This plugin offers a range of nodes to capture the viewport. Record gameplay, take screenshots with and without UI and take high resolution screenshot all from inside the engine.
Record in-game footage
ViewportRecorder allows developers and player to record videos in-game with no external screen capture software. Videos can be captured at resolutions up to 1920x1080 at 60fps. The plugin includes blueprint nodes to set the recording resolution and target framerate.
Videos will be saved in AVI format using the DVIX codec. They will be exported to the specified path.
The plugin also allows you to take screenshots in three different ways.
Regular screenshots which are captured at the screen's resolution. The plugin allows you to capture them with and without the UI (no need to implement additional logic to hide widgets).
High Resolution Screenshots which require a resolution multiplier to be input and will render out a higher resolution screenshots.
In both cases, images are saved as PNGs at the specified path.
Windows Save File Dialog
ViewportRecorder enables developers and players to choose a specific path by using Window's default save file dialog. It can be used for any type of files, and returns the chosen path.
It is however not required for the recording feature to work, you could also set a path manually, or via a custom path finder.
NOTE: The SaveFileDialog window will use the system's default language.
Initialising the plugin
To start using the plugin, it needs to be enabled in Plugins -> Viewportrecorder. Once done you should be able to call the InitialiseViewportRecorder in any blueprint. When doing so you will have the choice in three performance mode:
- No multithreading: The recording will be executed on the game thread. This means the recording's framerate will be tied to the game's.
- Multithreading (1 thread): The recording will be done on another thread. It will make the plugin work as if it was an external program and won't affect the game's performance as much.
- Multithreading (2 threads): Allows the plugin to use two additional threads. This mode has the best performances out of the three but might not fully work on some systems.
NOTE: Multithreading might cause the editor to be unstable on less powerful systems.
Set up the recording
Before recording there is two function you might be interested in implementing, SetResolution and GetPathFromExplorer.
SetResolution allows you to set the resolution for the recording. This can also be done via SetResolutionFromVector2D. Once the recording finished, you can use ResetResolution to set the game back to the previous resolution.
NOTE: If the recording is started while the game running at a resolution greater than 1920x1080, the plugin will automatically set the resolution to it.
GetPathFromExplorer allows the user to specify a path to save files to. It uses Window's default SaveFileDialog prompt.
The plugin offers three screen capture methods:
StartVideoRecording starts recording at the specified frame rate and will export to the specified path. Videos are capped at 9000 frames meaning that a 25 fps recording will be capped at 9000 / 25 = 360 seconds. One way to continue recording once this capped reach is by ticking RecordInParts which will start record in a second file once the cap reached.
Recording can be paused and resumed via TogglePauseRecording. Finally, it is stopped by using StopVideoRecording.
TakeScreenshot will request a screenshot at the game's resolution and will save it as a JPEG at the specified path. ShowUI will toggle the capture of the widgets when taking screenshots.
TakeHighResolutionRender will capture a high resolution shot at the specified resolution. The resolution multiplier will determine to shot's resolution. The picture will be saved as a JPEG at the specified path.
A selection of variables are exposed to blueprint to more accurately check the recording's status.
isRecordingVideo: Indicates whether or not the plugin is currently recording.
RecordingFramerate: Indicates how many frames have been captured since the beginning of the recording.
CurrentFPS: If a recording is active this will return the actual framerate of the recording.
useMultithreading: This boolean allows you to activate Multithreading (1 thread) recording mode at runtime.
useSecondaryThread: If Multithreading (1 thread) is ticked, this will activate Multitreading (2 threads) recording mode.
EnableLogMessages: This will allow the plugin to post log messages to the output log. This is useful to debug errors, and features not working.
The plugin has been tested on two different systems to gauge performance. The first system can be considered a above average computer in terms of performance. The second system is however a relatively low performing one.
The framerate shown is the recording's average on a 30 second video. These stats should give a good insight at what performance to expect. It is mainly hungry in CPU power, depending on your system, performance will vary.
A demo build is available to download: here.