OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

RecordingOptions

public sealed record RecordingOptions : IEquatable<RecordingOptions>

Everything a recording can be asked for as it starts: how long to run, and when to roll over into the next file.

Segmentation is what makes a long recording survive a destination that caps a single file. A lossless recording of a 640x480 sensor passes 4 GiB in well under an hour; without a size limit the recording simply dies at whatever boundary the destination has. Set RecordingOptions.MaxSegmentBytes to that cap and the recording rolls over into name_part000.mkv, name_part001.mkv, name_part002.mkv and so on instead. Any size is accepted; this is not tied to a file system.

Every part carries a suffix, the first one included, and that changed in API version 24. run.mkv with a segment limit writes run_part000.mkv and nothing at run.mkv. The first file used to keep the name it was given, so this is a breaking change for an application that passed a path and then reopened it: it must take the name from the RecordingPhase.SegmentCompleted event, which reports every finished file including the first, or open _part000 itself. With no segment limit the path is used exactly as given -- one whole file is not a part of anything -- so only recordings that asked to roll over are affected.

Every segment carries the camera's identity, the measurement configuration and every attachment, so each file stands on its own, and each finished one arrives as a RecordingPhase.SegmentCompleted event.

RecordingOptions: constructors

public RecordingOptions()

RecordingOptions: properties

public bool AllIntra { get; init; }

Make every frame a seek anchor, so a clip can later be cut at any frame with no re-encode.

The cost is a per-frame constant (measured at 416 to 460 bytes, a frame header and a fresh range-coder state table, independent of the picture), which is +0.66 % on a 382x288 sensor and +0.23 % on 640x480. false, the default, keeps the encoder's own interval, which makes one frame in twelve an anchor.

public TimeSpan Duration { get; init; }

Stop without being asked after this long. TimeSpan.Zero means run until stopped.

The clock starts once the recording is live, after any pre-roll has been written out.

Carried as whole milliseconds: rounded, and never down to zero, since zero is the sentinel above. A duration under a millisecond records for a millisecond; it does not record forever.

public bool HoldOpenAcrossReconnect { get; init; }

Hold this recording open across a camera outage, instead of stopping it when the SDK re-opens the camera.

false by default, which is what every recording has always done: a reconnect is a re-open, so the file is finalized before the teardown and RecordingPhase.Stopped arrives carrying RecordingStopReason.Reconnect. An application that wants a second file opens one when it sees ReconnectPhase.Recovered.

true keeps the recording running: the file stays open, ThermalCamera.IsRecording stays true, and the frames from after the re-open go into the same file as the frames from before it, with a marker of the gap written into the file on the first frame that arrives afterwards, which a replay reads back through ThermalCamera.GetRecordedGap.

Which to choose, because neither is free. Stop is the honest default. An outage has no known length (the SDK waits for an absent camera indefinitely rather than exhausting its budget), so a held-open file can be a recording that looks live for hours and contains minutes, and RecordingOptions.Duration keeps running through an outage it cannot capture, so the requested duration is not honoured either way. Hold open is right when one file per shift matters more than each file being contiguous. The hole is in the file either way; this decides whether the file boundary is in it too.

It changes nothing about the outage itself. Frames do not arrive during one whichever this is set to, the pre-roll ring is not cleared either way, and interval capture is unaffected.

public ulong MaxSegmentBytes { get; init; }

Roll over into the next file before it would pass this size, in bytes. 0 disables it.

A ceiling for the finished file, trailer included. A part that has been rolled over is never larger than this. The recorder projects what the part will hold (the open Matroska Cluster, the muxer's interleaving queue, the frame about to be written, and the Cues the trailer puts down), and rolls over while all of it still fits, rather than comparing the position it has reached against the limit.

It did the latter until v12, and a part therefore ended past the limit by everything written after the last check: measured, 1.6 MB past a 4 GiB limit on a PI 640i, and 31 % past a 1 MiB limit on 160x120 noise. You no longer need a margin of your own for the recording itself, and no fixed margin would have been enough: the Cues grow with the part's frame count at about 24 B a frame, so they consume 4 MiB on their own at about 172,800 frames. A margin for an attachment you mean to add afterwards is still yours to leave.

A part can finish somewhat under the limit, because the projection is an upper bound.

public TimeSpan MaxSegmentDuration { get; init; }

Roll over into the next file after this much recorded time. TimeSpan.Zero disables it.

Values below one second are raised to one second.

Carried as whole milliseconds: rounded, and never down to zero, since zero is the sentinel above. A rollover asked for in microseconds becomes the one-second minimum, not no rollover at all, which matters, because "no rollover" is how a recording meant to stay under FAT32's 4 GiB dies at the boundary instead.

public ulong MinimumFreeBytes { get; init; }

Refuse to start at all if the destination has fewer than this many bytes free. Zero, the default, does not check.

Honoured by ThermalCamera.StartRecording(…) and its overloads and by an alarm rule's RecordingAction, which is the point: a rule starts the camera's recording on the SDK's own action thread, with no call of yours in front of it. So an application that refuses its own starts on a nearly full disk still had an alarm start one behind its back, which its low-water watch then stopped seconds later -- and the next activation started another.

A direct start throws InsufficientSpaceException, naming what was free and what was required. A rule's start reports an ActionError on ThermalCamera.ActionFailed(…) instead, that being the only channel a rule's action has.

The same name, unit and "zero is off" convention as ContinuousOptions.MinimumFreeBytes. It is a floor at the start only: nothing stops a recording that has already begun, and no headroom is added to the comparison.

public uint QuantizeCounts { get; init; }

Round each temperature sample to a multiple of this many counts before encoding. Lossy. Opt-in. Zero or one records exactly, and is the default.

One count is 0.1 K, so the error is bounded and known in advance: no sample of any frame moves by more than half a step. Measured against the same frames recorded losslessly, on 640x480: a step of 2 costs 0.1 K and 81 % of the size, 4 costs 0.2 K and 62 %, 8 costs 0.4 K and 43 %, 16 costs 0.8 K and 27 %.

Use a power of two. A step of 5 has the same 0.2 K worst case as a step of 4 and makes a file 41 % larger, because the compressor codes prediction residuals and a power-of-two step is exactly "drop the low bits".

A recording stores finished temperatures, so this alters the measurement permanently, which is why the file declares it, and why ThermalCamera.GetRecordedLossy exists for a reader to ask.

public int VisualJpegQuality { get; init; }

Quality, 2 (best) to 31 (worst), for encoding a visual track as MJPEG instead of losslessly. Zero, the default, keeps it lossless.

Ignored on a thermal track, with a warning: MJPEG is eight bits a sample and a 16-bit temperature cannot go through it and still be a temperature. Use RecordingOptions.QuantizeCounts there.