Class TimeshiftSettings
- Namespace
- VisioForge.Core.Types.VideoCapture
- Assembly
- VisioForge.Core.dll
Provides configuration settings for timeshift functionality in video capture operations.
public class TimeshiftSettingsInheritance
Inherited Members
Remarks
Timeshift enables viewers to pause, rewind, and fast-forward live video streams by continuously recording the stream to temporary storage while simultaneously allowing playback from that storage. This creates a buffer that allows time-shifted viewing of live content.
The implementation uses Stream Buffer Engine (SBE) technology to manage the recording and playback processes. Multiple backing files are used to store the content, with automatic file rotation to manage storage space efficiently.
Common use cases include: - Pausing live TV to resume watching later - Rewinding to replay interesting moments - Fast-forwarding through previously recorded content - Creating a delay buffer for censorship or editing purposes
Constructors
TimeshiftSettings()
Initializes a new instance of the VisioForge.Core.Types.VideoCapture.TimeshiftSettings class with default values.
public TimeshiftSettings()Remarks
The default configuration creates a 1-hour timeshift buffer in the system's temporary folder. A new unique recording ID is automatically generated for each instance.
Default values: - Temporary folder: System temp path + "SBE\" - Backing file count: 4-6 files - Buffer duration: 1 hour (3600 seconds) - Recording ID: New GUID
Properties
BackingFileCountMaximum
Gets or sets the maximum number of backing files allowed in the timeshift buffer.
public int BackingFileCountMaximum { get; set; }Property Value
Remarks
This property defines the upper limit for the number of backing files. When this limit is reached, the oldest files are deleted to make room for new ones, creating a rolling buffer of content.
The difference between minimum and maximum provides a buffer zone that helps maintain smooth operation during file rotation operations.
BackingFileCountMinimum
Gets or sets the minimum number of backing files to maintain in the timeshift buffer.
public int BackingFileCountMinimum { get; set; }Property Value
Remarks
The Stream Buffer Engine uses multiple files to store the timeshift buffer. This property sets the minimum number of files that will be kept at all times. Having multiple files allows for efficient file rotation and prevents fragmentation.
Lower values use less disk space but may impact seek performance. Higher values provide smoother operation but require more storage space.
BackingFileDuration
Gets or sets the total duration of content that can be stored in all backing files.
public int BackingFileDuration { get; set; }Property Value
Remarks
This property determines how much content history is available for timeshift operations. The actual storage space required depends on this duration and the bitrate of the video being captured.
For example, with a 1-hour duration and a 5 Mbps video stream, approximately 2.25 GB of storage space would be required for the buffer.
CaptureMode
Gets or sets a value indicating whether the Stream Buffer Engine should operate in capture mode.
public bool CaptureMode { get; set; }Property Value
Remarks
When capture mode is enabled, the SBE encoder writes directly to the final output location. When disabled, temporary files are used for buffering, which can provide better performance for timeshift operations but requires additional disk space.
Temporary file mode is typically preferred for timeshift functionality as it allows more flexible seek operations and better manages disk I/O.
EncodingSettings
Gets or sets the encoding settings used for the timeshift buffer.
public MP4Output EncodingSettings { get; set; }Property Value
Remarks
These settings control how the video and audio are encoded when written to the timeshift buffer. The quality and bitrate settings directly impact the storage space required and the CPU usage during capture.
Choose encoding settings that balance quality requirements with available system resources and storage space. Lower bitrates reduce storage requirements but may impact visual quality.
OutputFormat
Gets or sets the output format used by the Stream Buffer Engine encoder.
public SBEOutputFormat OutputFormat { get; set; }Property Value
Remarks
The output format determines how the video stream is encoded for storage in the timeshift buffer. Different formats offer different trade-offs between quality, file size, and CPU usage. Choose a format that balances your quality requirements with available system resources.
Player_AudioOutput_Device
Gets or sets the audio output device to use for timeshift playback.
public string Player_AudioOutput_Device { get; set; }Property Value
Remarks
This property allows you to specify which audio device should be used for playback of the time-shifted content. The device name should match one of the available audio output devices on the system.
If the specified device is not available, the system will typically fall back to the default audio output device.
Player_AudioOutput_Enabled
Gets or sets a value indicating whether audio playback is enabled during timeshift playback.
public bool Player_AudioOutput_Enabled { get; set; }Property Value
Remarks
When disabled, the video will play without sound. This can be useful for preview purposes or when audio output is handled by a separate system. Audio is still recorded to the timeshift buffer regardless of this setting.
Player_Screen
Gets or sets the video view control where the time-shifted content will be displayed.
[JsonIgnore]
public IVideoView Player_Screen { get; set; }Property Value
Remarks
This property specifies where the playback of time-shifted content should be rendered. The video view must be properly initialized and attached to a visible UI element before starting timeshift playback. This property is not serialized to JSON.
RecordingID
Gets or sets the unique identifier for this timeshift recording session.
public Guid RecordingID { get; set; }Property Value
Remarks
This ID is used to differentiate between multiple timeshift sessions and to manage the associated temporary files. A new GUID is automatically generated when creating a new instance of this class. The same ID should be used when resuming a session.
TempFolder
Gets or sets the folder path where temporary timeshift files will be stored.
public string TempFolder { get; set; }Property Value
Remarks
This folder will contain the backing files used for timeshift buffering. Ensure the specified location has sufficient free space to accommodate the expected buffer size based on your VisioForge.Core.Types.VideoCapture.TimeshiftSettings.BackingFileDuration and video bitrate settings.
The folder will be created automatically if it doesn't exist. Write permissions are required for the application to create and manage the temporary files.