Go to any Blueprint, grab reference to RuntimeVideoRecorder and call Start/Stop recording. You can provide desired width, height and fps if needed. Example:
How to use: Buy & download RuntimeVideoRecorder from Gumroad. If you are not satisfied with the product quality then ask for a refund in Discord.
Additional information:
This repository also provides x264
and l-smash
static libraries for popular platforms (Windows, Linux, Mac and Android). If you have corresponding license for x264 and willing to fully open-source your Unreal project code you can probably use x264. However, this is not a legal advice, ask experts.