Skip to main content
Copy the **LCK **and **LCKUnrealAudio **plugins in the **Plugins **folder of the project. Open Unreal and make sure the plugins are enabled, they should be by default. To enable recording on Windows you will also need to enable the **AVCodecsCore **plugin (which should be enabled via dependency when you add LCK) and also add the relevant extension plugins like **NVCodecs **and AMFCodecs. Unfortunately as for now WMFCodecs only supports audio so it’s not a full Windows Media Foundation extension. Image3 Let’s start setting up our new amazing camera Image4 Image5 You will need a SceneCaptureComponent2D which is the minimum requirement but you may also want to add a timer and a viewfinder for preview. The minimal requirement to start recording are the following nodes that can be accessed from the LCKRecorderSubsystem Image20 SetupRecorder: setup the recording settings like resolution and samplerate. Samplerate should match the audio setup and for this version it needs to be 48kHz because Unreal only supports this on Android for microphone capture. Type “samplerate” in Project Settings and make sure it’s set to 48000 for Android. Image21 The second parameter for this node is the SceneCaptureComponent2D that we want to use as the actual source for the recording. Image16 Make sure the SceneCaptureComponent is not active when the recording is not needed. We don’t capture Every Frame anyway but we use the target framerate in RecorderParams Image25 StartPreview: this is an optional node and it allows the viewfinder to be activated before starting the actual recording process. It’s useful in conjunction with the RenderTarget node that can be requested once the preview is started. Image14 Image17 The RenderTarget can be used as a texture in the viewfinder component. StartRecording: once everything has been set up we can start the recording process. Make sure to check the returned value to validate if the recording has actually started successfully. Image7 GetTime: now you can get the recording time in seconds and breaking it down in minutes and seconds like this Image13 And show it to the player for a visual hint that the recording is working. StopRecording: when we are done we can stop the recording and the file will be saved in the gallery. This operation might take long depending on the length of the video (hence the size of the file to be copied to the gallery). You may also validate the return value to make sure everything went well. Image6 StopPreview: you can finally decide if you want to stop the preview so the camera stops rendering and save performance and battery life when not needed. Image31 Settings: finally you will need to customize the values in DefaultGame.ini Image26 And provide the actual TrackingId and the GameName which will be used to save the recorded videos in the gallery