ULCKRecorderSubsystem
The recorder subsystem manages the complete recording lifecycle as a UTickableWorldSubsystem.
Class Definition
UCLASS()
class LCKCORE_API ULCKRecorderSubsystem : public UTickableWorldSubsystem
{
GENERATED_BODY()
public:
// Scene capture component for video source
UPROPERTY(Category = "LCK", BlueprintReadOnly)
USceneCaptureComponent2D* CaptureComponent;
// Render target for capture
UPROPERTY(Category = "LCK", BlueprintReadOnly)
UTextureRenderTarget2D* RenderTarget;
};
Setup Methods
Initializes the recorder with parameters and optional capture component.UFUNCTION(Category="LCK", BlueprintCallable)
void SetupRecorder(
const FLCKRecorderParams& RecorderParams,
USceneCaptureComponent2D* InitialCaptureComponent = nullptr
);
Sets or changes the scene capture component used for video source.UFUNCTION(Category="LCK", BlueprintCallable)
void SetSceneCaptureComponent(USceneCaptureComponent2D* NewSceneCaptureComponent);
Recording Control
Begins recording. Returns false if already recording or encoder unavailable.UFUNCTION(Category="LCK", BlueprintCallable)
bool StartRecording();
Stops recording and finalizes the video file.UFUNCTION(Category="LCK", BlueprintCallable)
bool StopRecording();
Captures a single frame as a photo.UFUNCTION(Category="LCK", BlueprintCallable)
bool TakePhoto();
Async Methods
For non-blocking operations with callbacks:
// Start recording with callback
void StartRecordingAsync(FOnLCKRecorderBoolResult OnResult);
// Stop recording with progress callback
void StopRecordingAsync(
FOnLCKRecorderBoolResult OnResult,
FOnLCKRecorderProgress OnProgress
);
Recorder->StartRecordingAsync(
FOnLCKRecorderBoolResult::CreateLambda([](bool bSuccess) {
if (bSuccess)
UE_LOG(LogTemp, Log, TEXT("Recording started"));
else
UE_LOG(LogTemp, Error, TEXT("Failed to start recording"));
})
);
State Queries
Returns true if currently recording.UFUNCTION(BlueprintCallable, Category = "LCK")
bool IsRecording() const;
Returns current recording duration in seconds.UFUNCTION(BlueprintCallable, Category = "LCK")
float GetTime() const;
Returns current microphone input level (0.0 - 1.0).UFUNCTION(BlueprintCallable, Category = "LCK")
float GetMicrophoneVolume() const;
Microphone Control
Enables or disables microphone audio in recordings.UFUNCTION(BlueprintCallable, Category = "LCK")
void SetMicrophoneEnabled(bool bEnabled);
Returns whether microphone audio is enabled.UFUNCTION(BlueprintPure, Category = "LCK")
bool IsMicrophoneEnabled() const;
FLCKRecorderParams
Recording configuration structure.
USTRUCT(BlueprintType)
struct LCKCORE_API FLCKRecorderParams
{
GENERATED_BODY()
UPROPERTY(Category="LCK", EditAnywhere, BlueprintReadWrite)
int32 Width = 1920;
UPROPERTY(Category="LCK", EditAnywhere, BlueprintReadWrite)
int32 Height = 1080;
UPROPERTY(Category="LCK", EditAnywhere, BlueprintReadWrite)
int32 Framerate = 30;
UPROPERTY(Category="LCK", EditAnywhere, BlueprintReadWrite)
int32 VideoBitrate = 2 << 20; // 2 Mbps default
UPROPERTY(Category="LCK", EditAnywhere, BlueprintReadWrite)
int32 Samplerate = 48000;
UPROPERTY(Category="LCK", EditAnywhere, BlueprintReadWrite)
int32 AudioBitrate = 256 << 10; // 256 Kbps default
};
Recommended Settings
| Quality | Resolution | Video Bitrate | Audio Bitrate |
|---|
| SD | 1280 x 720 | 2-4 Mbps | 128-256 Kbps |
| HD | 1920 x 1080 | 4-8 Mbps | 256 Kbps |
| 2K | 2560 x 1440 | 8-12 Mbps | 256 Kbps |
| 4K | 3840 x 2160 | 12-20 Mbps | 320 Kbps |
Higher resolutions significantly impact performance, especially on mobile VR devices. Test thoroughly on target hardware.
Delegates
FOnLCKRecorderBoolResult
Result callback for async operations.
DECLARE_DELEGATE_OneParam(FOnLCKRecorderBoolResult, bool /*bSuccess*/);
FOnLCKRecorderProgress
Progress callback for save operations.
DECLARE_DELEGATE_OneParam(FOnLCKRecorderProgress, float /*Progress*/);
Preview Mode
For live camera preview without recording:
// Start preview (capture frames but don't encode)
Recorder->StartPreview();
// Stop preview
Recorder->StopPreview();
Preview mode is useful for camera composition and settings adjustment before recording.